Update docs.
[m6w6/libmemcached] / libmemcached / behavior.c
index e250241b3307e6a29c7bd82172e45979d3860b4f..b84e770a5b559cf2f35d6e6e7aa4fdca215b1b3e 100644 (file)
@@ -12,8 +12,6 @@
 #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)
 {
@@ -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:
+    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;
@@ -157,6 +156,10 @@ memcached_return_t memcached_behavior_set(memcached_st *ptr,
     ptr->recv_size= (int32_t)data;
     memcached_quit(ptr);
     break;
+  case MEMCACHED_BEHAVIOR_TCP_KEEPIDLE:
+    ptr->tcp_keepidle= (uint32_t)data;
+    memcached_quit(ptr);
+    break;
   case MEMCACHED_BEHAVIOR_USER_DATA:
     return MEMCACHED_FAILURE;
   case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY:
@@ -234,7 +237,7 @@ memcached_return_t memcached_behavior_set(memcached_st *ptr,
   return MEMCACHED_SUCCESS;
 }
 
-inline bool _is_auto_eject_host(const memcached_st *ptr)
+bool _is_auto_eject_host(const memcached_st *ptr)
 {
   return ptr->flags.auto_eject_hosts;
 }
@@ -292,6 +295,8 @@ uint64_t memcached_behavior_get(memcached_st *ptr,
     return (uint64_t)ptr->snd_timeout;
   case MEMCACHED_BEHAVIOR_RCV_TIMEOUT:
     return (uint64_t)ptr->rcv_timeout;
+  case MEMCACHED_BEHAVIOR_TCP_KEEPIDLE:
+    return (uint64_t)ptr->tcp_keepidle;
   case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
     {
       int sock_size= 0;