mcmc.c (memcached-1.6.14) | : | mcmc.c (memcached-1.6.15) | ||
---|---|---|---|---|
skipping to change at line 457 | skipping to change at line 457 | |||
goto end; | goto end; | |||
} | } | |||
} | } | |||
for (next = ai; next != NULL; next = next->ai_next) { | for (next = ai; next != NULL; next = next->ai_next) { | |||
sock = socket(next->ai_family, next->ai_socktype, | sock = socket(next->ai_family, next->ai_socktype, | |||
next->ai_protocol); | next->ai_protocol); | |||
if (sock == -1) | if (sock == -1) | |||
continue; | continue; | |||
// TODO: NONBLOCK | if (options & MCMC_OPTION_TCP_KEEPALIVE) { | |||
int optval = 1; | ||||
if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optva | ||||
l)) < 0) { | ||||
res = MCMC_ERR; | ||||
close(sock); | ||||
goto end; | ||||
} | ||||
} | ||||
if (options & MCMC_OPTION_NONBLOCK) { | if (options & MCMC_OPTION_NONBLOCK) { | |||
int flags = fcntl(sock, F_GETFL); | int flags = fcntl(sock, F_GETFL); | |||
if (flags < 0) { | if (flags < 0) { | |||
res = MCMC_ERR; | res = MCMC_ERR; | |||
close(sock); | close(sock); | |||
goto end; | goto end; | |||
} | } | |||
if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) { | if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) { | |||
res = MCMC_ERR; | res = MCMC_ERR; | |||
close(sock); | close(sock); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 10 lines changed or added |