Bug fix in documentation Tim found.
[awesomized/libmemcached] / libmemcached / memcached_get.c
index f6c81338a1bf817f376c789fb179756a1cafa658..34fcb4ea974a1ad2729e000ff2fac2624558d160 100644 (file)
@@ -51,22 +51,28 @@ char *memcached_get_by_key(memcached_st *ptr,
       /* On all failure drop to returning NULL */
       if (rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED)
       {
-        uint8_t latch; /* We use latch to track the state of the original socket */
-
         if (rc == MEMCACHED_BUFFERED)
         {
+          uint8_t latch; /* We use latch to track the state of the original socket */
           latch= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS);
           if (latch == 0)
             memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1);
-        }
 
-        rc= memcached_set(ptr, key, key_length, 
-                          memcached_result_value(&ptr->result),
-                          memcached_result_length(&ptr->result),
-                          0, memcached_result_flags(&ptr->result));
+          rc= memcached_set(ptr, key, key_length, 
+                            memcached_result_value(&ptr->result),
+                            memcached_result_length(&ptr->result),
+                            0, memcached_result_flags(&ptr->result));
 
-        if (rc == MEMCACHED_BUFFERED && latch == 0)
-          memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 0);
+          if (rc == MEMCACHED_BUFFERED && latch == 0)
+            memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 0);
+        }
+        else
+        {
+          rc= memcached_set(ptr, key, key_length, 
+                            memcached_result_value(&ptr->result),
+                            memcached_result_length(&ptr->result),
+                            0, memcached_result_flags(&ptr->result));
+        }
 
         if (rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED)
         {