+ if (ptr->root->flags.tcp_keepalive)
+ {
+ int flag= 1;
+ int error;
+
+ error= setsockopt(ptr->fd, SOL_SOCKET, SO_KEEPALIVE,
+ &flag, (socklen_t)sizeof(int));
+ WATCHPOINT_ASSERT(error == 0);
+ if (error)
+ return MEMCACHED_FAILURE;
+ }
+
+#ifdef TCP_KEEPIDLE
+ if (ptr->root->tcp_keepidle > 0)
+ {
+ int error;
+
+ error= setsockopt(ptr->fd, IPPROTO_TCP, TCP_KEEPIDLE,
+ &ptr->root->tcp_keepidle, (socklen_t)sizeof(int));
+ WATCHPOINT_ASSERT(error == 0);
+ if (error)
+ return MEMCACHED_FAILURE;
+ }
+#endif
+
+ if (ptr->root->send_size > 0)