projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge in bug fix for 456080.
[m6w6/libmemcached]
/
libmemcached
/
behavior.c
diff --git
a/libmemcached/behavior.c
b/libmemcached/behavior.c
index f1573b608653e86dc0629b4438736130c835fcde..2b6ccdf9112fda235bb2dc163497b9b49fd712f4 100644
(file)
--- a/
libmemcached/behavior.c
+++ b/
libmemcached/behavior.c
@@
-12,8
+12,6
@@
#include "common.h"
#include <time.h>
#include <sys/types.h>
#include "common.h"
#include <time.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
static bool set_flag(uint64_t data)
{
static bool set_flag(uint64_t data)
{
@@
-55,6
+53,7
@@
memcached_return_t memcached_behavior_set(memcached_st *ptr,
ptr->server_failure_limit= (uint32_t)data;
break;
case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL:
ptr->server_failure_limit= (uint32_t)data;
break;
case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL:
+ memcached_quit(ptr); // We need t shutdown all of the connections to make sure we do the correct protocol
if (data)
{
ptr->flags.verify_key= false;
if (data)
{
ptr->flags.verify_key= false;
@@
-314,11
+313,20
@@
uint64_t memcached_behavior_get(memcached_st *ptr,
/* REFACTOR */
/* We just try the first host, and if it is down we return zero */
if ((memcached_connect(instance)) != MEMCACHED_SUCCESS)
/* REFACTOR */
/* We just try the first host, and if it is down we return zero */
if ((memcached_connect(instance)) != MEMCACHED_SUCCESS)
+ {
+ return 0;
+ }
+
+ if (memcached_io_wait_for_write(instance) != MEMCACHED_SUCCESS)
+ {
return 0;
return 0;
+ }
- if (getsockopt(instance->fd, SOL_SOCKET,
- SO_SNDBUF, &sock_size, &sock_length))
+ if (getsockopt(instance->fd, SOL_SOCKET, SO_SNDBUF, &sock_size, &sock_length) < 0)
+ {
+ ptr->cached_errno= errno;
return 0; /* Zero means error */
return 0; /* Zero means error */
+ }
}
return (uint64_t) sock_size;
}
return (uint64_t) sock_size;
@@
-341,11
+349,20
@@
uint64_t memcached_behavior_get(memcached_st *ptr,
{
/* We just try the first host, and if it is down we return zero */
if ((memcached_connect(instance)) != MEMCACHED_SUCCESS)
{
/* We just try the first host, and if it is down we return zero */
if ((memcached_connect(instance)) != MEMCACHED_SUCCESS)
+ {
+ return 0;
+ }
+
+ if (memcached_io_wait_for_write(instance) != MEMCACHED_SUCCESS)
+ {
return 0;
return 0;
+ }
- if (getsockopt(instance->fd, SOL_SOCKET,
- SO_RCVBUF, &sock_size, &sock_length))
+ if (getsockopt(instance->fd, SOL_SOCKET, SO_RCVBUF, &sock_size, &sock_length) < 0)
+ {
+ ptr->cached_errno= errno;
return 0; /* Zero means error */
return 0; /* Zero means error */
+ }
}
}