Small cleanup in string.h and converted result_st macro to inline.
[awesomized/libmemcached] / libmemcached / io.c
index 5102d95b7b118cda6aae0e8086748395ddcb37d5..6aad480510f4ce5df02fab12273ca6220a1e4cc4 100644 (file)
@@ -127,14 +127,14 @@ static bool process_input_buffer(memcached_server_instance_st *ptr)
    */
     memcached_callback_st cb= *ptr->root->callbacks;
 
-    ptr->root->options.is_processing_input= true;
+    memcached_set_processing_input(ptr->root, true);
 
     char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
     memcached_return_t error;
     error= memcached_response(ptr, buffer, sizeof(buffer),
                               &ptr->root->result);
 
-    ptr->root->options.is_processing_input = false;
+    memcached_set_processing_input(ptr->root, false);
 
     if (error == MEMCACHED_SUCCESS)
     {
@@ -160,8 +160,11 @@ static inline void memcached_io_cork_push(memcached_server_st *ptr)
   if (ptr->root->flags.cork == false || ptr->state.is_corked)
     return;
 
-  ptr->state.is_corked=
-    cork_switch(ptr, true) == MEM_TRUE ? true : false;
+  int enable= 1;
+  int err= setsockopt(ptr->fd, IPPROTO_TCP, CORK,
+                      &enable, (socklen_t)sizeof(int));
+  if (! err)
+    ptr->state.is_corked= true;
 
   WATCHPOINT_ASSERT(ptr->state.is_corked == true);
 #else
@@ -175,8 +178,11 @@ static inline void memcached_io_cork_pop(memcached_server_st *ptr)
   if (ptr->root->flags.cork == false || ptr->state.is_corked == false)
     return;
 
-  ptr->state.is_corked=
-    cork_switch(ptr, false) == MEM_FALSE ? false : true;
+  int enable= 0;
+  int err= setsockopt(ptr->fd, IPPROTO_TCP, CORK,
+                      &enable, (socklen_t)sizeof(int));
+  if (! err)
+    ptr->state.is_corked= false;
 
   WATCHPOINT_ASSERT(ptr->state.is_corked == false);
 #else