{
int res;
int val;
+ const char *errpos;
bool ok;
/*
* Generic stuff + nonblock.
*/
+ errpos = "socket_setup";
ok = socket_setup(sock, true);
if (!ok)
goto fail;
/*
* TCP Keepalive
*/
+ errpos = "socket_set_keepalive";
ok = socket_set_keepalive(sock, cf_tcp_keepalive, cf_tcp_keepidle,
cf_tcp_keepintvl, cf_tcp_keepcnt);
if (!ok)
*/
if (cf_tcp_socket_buffer) {
val = cf_tcp_socket_buffer;
+ errpos = "setsockopt/SO_SNDBUF";
res = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &val, sizeof(val));
if (res < 0)
goto fail;
val = cf_tcp_socket_buffer;
+ errpos = "setsockopt/SO_RCVBUF";
res = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &val, sizeof(val));
if (res < 0)
goto fail;
* Turn off kernel buffering, each send() will be one packet.
*/
val = 1;
+ errpos = "setsockopt/TCP_NODELAY";
res = setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
if (res < 0)
goto fail;
return true;
fail:
- log_warning("tune_socket(%d) failed: %s", sock, strerror(errno));
+ log_warning("%s(%d) failed: %s", errpos, sock, strerror(errno));
return false;
}