On Jul 30, 2015, at 1:38 AM, Charles Davis <cdavis5x(a)gmail.com> wrote:
> @@ -4459,14 +4464,20 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
> fd = get_sock_fd(s, 0, NULL);
> if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&keepalive, sizeof(int)) == -1)
> status = WSAEINVAL;
> -#if defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL)
> +#if defined(TCP_KEEPIDLE)
This could be an #ifdef, but see below.
> /* these values need to be set only if SO_KEEPALIVE is enabled */
> else if(keepalive)
> {
> if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, (void *)&keepidle, sizeof(int)) == -1)
> status = WSAEINVAL;
> + /* TCP_KEEPINTVL was only introduced on Mac in 10.9 */
> +#ifdef TCP_KEEPINTVL
> else if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&keepintvl, sizeof(int)) == -1)
> status = WSAEINVAL;
> +#else
> + else
> + FIXME("ignoring keepalive interval\n");
> +#endif
> }
> #else
> else
The #ifdef's in the above don't seem quite right. If TCP_KEEPINTVL is a legitimate alternative to TCP_KEEPIDLE/TCP_KEEPALIVE, then why is the latter a precondition for trying the former? That is, if TCP_KEEPINTVL is defined but TCP_KEEPIDLE is not, we still don't try it. That's not something that you introduced, but might as well fix it.
-Ken