libmemcached: fix #50 with supplied patch
authorMichael Wallner <mike@php.net>
Tue, 21 Jan 2020 17:35:13 +0000 (18:35 +0100)
committerMichael Wallner <mike@php.net>
Tue, 21 Jan 2020 17:35:13 +0000 (18:35 +0100)
libmemcached/instance.cc
libmemcached/instance.hpp
libmemcached/io.cc

index 53f74f79365ee5d5a48e11a3f78e1497232db8e7..df08c6066b3eabcb32959e39fd66d654d8d76200 100644 (file)
@@ -68,7 +68,6 @@ static inline void _server_init(memcached_instance_st* self, Memcached *root,
   self->error_messages= NULL;
   self->read_ptr= self->read_buffer;
   self->read_buffer_length= 0;
-  self->read_data_length= 0;
   self->write_buffer_offset= 0;
   self->address_info= NULL;
   self->address_info_next= NULL;
index 4db3c7f801189eb8c1c6f36376533f3cfd44f913..63bf0835e58b937f39c473f835cf3427a306f78c 100644 (file)
@@ -165,7 +165,6 @@ struct memcached_instance_st {
   memcached_connection_t type;
   char *read_ptr;
   size_t read_buffer_length;
-  size_t read_data_length;
   size_t write_buffer_offset;
   struct addrinfo *address_info;
   struct addrinfo *address_info_next;
index e246f3ec50d4165eb812e25829bff1b24055c3c1..d2196f67d1e6524a0585f9999e2dca2facfb35e4 100644 (file)
@@ -70,7 +70,6 @@ static bool repack_input_buffer(memcached_instance_st* instance)
    */
     memmove(instance->read_buffer, instance->read_ptr, instance->read_buffer_length);
     instance->read_ptr= instance->read_buffer;
-    instance->read_data_length= instance->read_buffer_length;
   }
 
   /* There is room in the buffer, try to fill it! */
@@ -80,8 +79,8 @@ static bool repack_input_buffer(memcached_instance_st* instance)
       /* Just try a single read to grab what's available */
       ssize_t nr;
       if ((nr= ::recv(instance->fd,
-                      instance->read_ptr + instance->read_data_length,
-                      MEMCACHED_MAX_BUFFER - instance->read_data_length,
+                      instance->read_ptr + instance->read_buffer_length,
+                      MEMCACHED_MAX_BUFFER - instance->read_buffer_length,
                       MSG_NOSIGNAL)) <= 0)
       {
         if (nr == 0)
@@ -113,7 +112,6 @@ static bool repack_input_buffer(memcached_instance_st* instance)
       }
       else // We read data, append to our read buffer
       {
-        instance->read_data_length+= size_t(nr);
         instance->read_buffer_length+= size_t(nr);
 
         return true;
@@ -491,7 +489,6 @@ static memcached_return_t _io_fill(memcached_instance_st* instance)
   } while (data_read <= 0);
 
   instance->io_bytes_sent= 0;
-  instance->read_data_length= (size_t) data_read;
   instance->read_buffer_length= (size_t) data_read;
   instance->read_ptr= instance->read_buffer;