return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE;
}
- /* For the moment, not getting a nonblocking mode will not be fatal */
if (ptr->flags & MEM_NO_BLOCK)
{
- int flags;
-
- flags= fcntl(ptr->hosts[server_key].fd, F_GETFL, 0);
- if (flags != -1)
- {
- (void)fcntl(ptr->hosts[server_key].fd, F_SETFL, flags | O_NONBLOCK);
-
- flags= 1;
- setsockopt(ptr->hosts[server_key].fd, IPPROTO_TCP, SO_LINGER,
- &flags, (socklen_t)sizeof(int));
- }
+ int error;
+ struct linger linger;
+
+ linger.l_onoff= 1;
+ linger.l_linger= MEMCACHED_DEFAULT_TIMEOUT;
+ error= setsockopt(ptr->hosts[server_key].fd, SOL_SOCKET, SO_LINGER,
+ &linger, (socklen_t)sizeof(struct linger));
+ WATCHPOINT_ASSERT(error == 0);
}
if (ptr->flags & MEM_TCP_NODELAY)
{
int flag= 1;
+ int error;
- setsockopt(ptr->hosts[server_key].fd, IPPROTO_TCP, TCP_NODELAY,
- &flag, (socklen_t)sizeof(int));
+ error= setsockopt(ptr->hosts[server_key].fd, IPPROTO_TCP, TCP_NODELAY,
+ &flag, (socklen_t)sizeof(int));
+ WATCHPOINT_ASSERT(error == 0);
}
if (ptr->send_size)
{
- setsockopt(ptr->hosts[server_key].fd, SOL_SOCKET, SO_SNDBUF,
- &ptr->send_size, (socklen_t)sizeof(int));
+ int error;
+
+ error= setsockopt(ptr->hosts[server_key].fd, SOL_SOCKET, SO_SNDBUF,
+ &ptr->send_size, (socklen_t)sizeof(int));
+ WATCHPOINT_ASSERT(error == 0);
}
if (ptr->recv_size)
{
- setsockopt(ptr->hosts[server_key].fd, SOL_SOCKET, SO_SNDBUF,
- &ptr->recv_size, (socklen_t)sizeof(int));
+ int error;
+
+ error= setsockopt(ptr->hosts[server_key].fd, SOL_SOCKET, SO_SNDBUF,
+ &ptr->recv_size, (socklen_t)sizeof(int));
+ WATCHPOINT_ASSERT(error == 0);
}
+ /* For the moment, not getting a nonblocking mode will not be fatal */
+ if (ptr->flags & MEM_NO_BLOCK)
+ {
+ int flags;
+
+ flags= fcntl(ptr->hosts[server_key].fd, F_GETFL, 0);
+ if (flags != -1)
+ {
+ (void)fcntl(ptr->hosts[server_key].fd, F_SETFL, flags | O_NONBLOCK);
+ }
+ }
+
+
/* connect to server */
test_connect:
if (connect(ptr->hosts[server_key].fd,
}
ptr->connected++;
}
+
WATCHPOINT_ASSERT(ptr->hosts[server_key].stack_responses == 0);
}