projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Removed recent regression issue with close()
[m6w6/libmemcached]
/
lib
/
memcached_connect.c
diff --git
a/lib/memcached_connect.c
b/lib/memcached_connect.c
index 672b1c23b65e5ce4f1d0c29c9502352186425d42..f4c80d5cc53d97e612f318a8694b825c2b7d6957 100644
(file)
--- a/
lib/memcached_connect.c
+++ b/
lib/memcached_connect.c
@@
-1,13
+1,5
@@
#include "common.h"
#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;
static memcached_return set_hostinfo(memcached_server_st *server)
{
struct addrinfo *ai;
@@
-140,17
+132,24
@@
static memcached_return tcp_connect(memcached_st *ptr, unsigned int server_key)
use->ai_protocol)) < 0)
{
ptr->cached_errno= errno;
use->ai_protocol)) < 0)
{
ptr->cached_errno= errno;
+ WATCHPOINT_ERRNO(errno);
return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE;
}
return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE;
}
- /* For the moment, not getting a nonblocking mode will not
e
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)
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);
(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)
}
if (ptr->flags & MEM_TCP_NODELAY)