ws2_32: socket keepalive for OSX
cdavis5x at gmail.com
Thu Jul 30 01:35:50 CDT 2015
> On Jul 29, 2015, at 7:30 PM, Matt Durgavich <mattdurgavich at gmail.com> wrote:
> --- a/dlls/ws2_32/socket.c
> +++ b/dlls/ws2_32/socket.c
> @@ -4468,6 +4468,15 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
> + else if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, (void*)&keepintvl, sizeof(int)) == -1)
> + status = WSAEINVAL;
This isn’t correct. Not for Darwin, anyway. TCP_KEEPALIVE on Darwin corresponds to Linux TCP_KEEPIDLE, not TCP_KEEPINTVL. (I checked. I read the kernel source to make sure of this.) The easiest way to implement this is to define TCP_KEEPIDLE to TCP_KEEPALIVE if TCP_KEEPIDLE isn’t defined but TCP_KEEPALIVE is. As for the other BSD systems, I’m pretty sure they implement the Linux interface (if at all). I know FreeBSD does.
Also, Darwin only grew support for TCP_KEEPINTVL in Darwin 13 (i.e. Mac OS 10.9), so even with my suggested change, the existing #ifdef block won’t get compiled in on lower than 10.9. If you want to support 10.6 (when TCP_KEEPALIVE was introduced) through 10.8, you might consider pulling the TCP_KEEPINTVL check into its own #ifdef block, and printing a FIXME if it isn’t defined.
You know what? I already have a patch that does all these things. I think I’ll just send that. (I’ve really got to start sending more of my patches upstream…)
More information about the wine-devel