int fd;
unsigned int stack_responses;
unsigned int cursor_active;
+ char write_buffer[MEMCACHED_MAX_BUFFER];
+ size_t write_buffer_offset;
+ char read_buffer[MEMCACHED_MAX_BUFFER];
+ size_t read_buffer_length;
+ char *read_ptr;
memcached_connection type;
};
memcached_server_st *hosts;
unsigned int number_of_hosts;
unsigned int cursor_server;
- char read_buffer[MEMCACHED_MAX_BUFFER];
- size_t read_buffer_length;
- char *read_ptr;
- char write_buffer[MEMCACHED_MAX_BUFFER];
- size_t write_buffer_offset;
char connected;
int cached_errno;
unsigned long long flags;
while (length)
{
- if (!ptr->read_buffer_length)
+ if (!ptr->hosts[server_key].read_buffer_length)
{
size_t data_read;
}
data_read= read(ptr->hosts[server_key].fd,
- ptr->read_buffer,
+ ptr->hosts[server_key].read_buffer,
MEMCACHED_MAX_BUFFER);
if (data_read == -1)
{
/* If zero, just keep looping */
}
- ptr->read_buffer_length= data_read;
- ptr->read_ptr= ptr->read_buffer;
+ ptr->hosts[server_key].read_buffer_length= data_read;
+ ptr->hosts[server_key].read_ptr= ptr->hosts[server_key].read_buffer;
}
- *buffer_ptr= *ptr->read_ptr;
+ *buffer_ptr= *ptr->hosts[server_key].read_ptr;
length--;
- ptr->read_ptr++;
- ptr->read_buffer_length--;
+ ptr->hosts[server_key].read_ptr++;
+ ptr->hosts[server_key].read_buffer_length--;
buffer_ptr++;
}
for (x= 0; x < length; x++)
{
- ptr->write_buffer[ptr->write_buffer_offset]= buffer[x];
- ptr->write_buffer_offset++;
+ ptr->hosts[server_key].write_buffer[ptr->hosts[server_key].write_buffer_offset]= buffer[x];
+ ptr->hosts[server_key].write_buffer_offset++;
- if (ptr->write_buffer_offset == MEMCACHED_MAX_BUFFER)
+ if (ptr->hosts[server_key].write_buffer_offset == MEMCACHED_MAX_BUFFER)
{
size_t sent_length;
sent_length= memcached_io_flush(ptr, server_key);
WATCHPOINT_ASSERT(sent_length == MEMCACHED_MAX_BUFFER);
- ptr->write_buffer_offset= 0;
+ ptr->hosts[server_key].write_buffer_offset= 0;
}
}
{
size_t sent_length;
size_t return_length;
- char *write_ptr= ptr->write_buffer;
- size_t write_length= ptr->write_buffer_offset;
+ char *write_ptr= ptr->hosts[server_key].write_buffer;
+ size_t write_length= ptr->hosts[server_key].write_buffer_offset;
unsigned int loop= 1;
- if (ptr->write_buffer_offset == 0)
+ if (ptr->hosts[server_key].write_buffer_offset == 0)
return 0;
return_length= 0;
}
WATCHPOINT_ASSERT(write_length == 0);
- WATCHPOINT_ASSERT(return_length == ptr->write_buffer_offset);
- ptr->write_buffer_offset= 0;
+ WATCHPOINT_ASSERT(return_length == ptr->hosts[server_key].write_buffer_offset);
+ ptr->hosts[server_key].write_buffer_offset= 0;
return return_length;
}
*/
void memcached_io_reset(memcached_st *ptr, unsigned int server_key)
{
- ptr->write_buffer_offset= 0;
+ ptr->hosts[server_key].write_buffer_offset= 0;
memcached_quit(ptr);
}