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));
}
}
+ if (ptr->flags & MEM_NO_BLOCK)
+ {
+ int error;
+ struct linger linger;
+
+ linger.l_onoff= 1;
+ linger.l_linger= 400;
+ 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);
}
/* connect to server */
}
ptr->connected++;
}
+
WATCHPOINT_ASSERT(ptr->hosts[server_key].stack_responses == 0);
}
memcached_return memcached_io_close(memcached_st *ptr, unsigned int server_key)
{
+ if (ptr->flags & MEM_NO_BLOCK && 0)
+ {
+ int sock_size;
+ int error;
+ socklen_t sock_length;
+
+ error= getsockopt(ptr->hosts[server_key].fd, IPPROTO_TCP, SO_LINGER,
+ &sock_size, &sock_length);
+
+ WATCHPOINT_NUMBER(error);
+ WATCHPOINT_NUMBER(sock_size);
+ }
+
close(ptr->hosts[server_key].fd);
return MEMCACHED_SUCCESS;