#include "common.h"
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/tcp.h>
-#include <netdb.h>
-#include <netinet/in.h>
-
static memcached_return set_hostinfo(memcached_server_st *server)
{
struct addrinfo *ai;
use->ai_protocol)) < 0)
{
ptr->cached_errno= errno;
+ WATCHPOINT_ERRNO(errno);
return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE;
}
- /* For the moment, not getting a nonblocking mode will note be fatal */
+ /* 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));
+ }
}
if (ptr->flags & MEM_TCP_NODELAY)