--- /dev/null
+Eirik A. Nygaard - IO Patch
+Cal Heldenbrand - Awesome feedback on performance
+Dustin Sallings - Insight into protocol
+Tobias Luetke - Performance Feedback
return -1;
}
- data_read= recv(ptr->hosts[server_key].fd,
+ data_read= read(ptr->hosts[server_key].fd,
ptr->read_buffer,
- MEMCACHED_MAX_BUFFER, 0);
+ MEMCACHED_MAX_BUFFER);
if (data_read == -1)
{
switch (errno)
ssize_t memcached_io_flush(memcached_st *ptr, unsigned int server_key)
{
size_t sent_length;
+ size_t return_length;
char *write_ptr= ptr->write_buffer;
size_t write_length= ptr->write_buffer_offset;
unsigned int loop= 1;
if (ptr->write_buffer_offset == 0)
return 0;
+ return_length= 0;
while (write_length)
{
if (ptr->flags & MEM_NO_BLOCK)
}
sent_length= 0;
- if ((sent_length= write(ptr->hosts[server_key].fd, write_ptr,
- write_length)) == -1)
+ if ((ssize_t)(sent_length= write(ptr->hosts[server_key].fd, write_ptr,
+ write_length)) == -1)
{
switch (errno)
{
case ENOBUFS:
case EAGAIN:
- if (loop < 10)
+ WATCHPOINT;
+ continue;
+ if (loop < 100)
{
loop++;
break;
return -1;
}
}
- else
- {
- write_ptr+= sent_length;
- write_length-= sent_length;
- }
+
+ write_ptr+= sent_length;
+ write_length-= sent_length;
+ return_length+= sent_length;
}
+ WATCHPOINT_ASSERT(write_length == 0);
+ WATCHPOINT_ASSERT(return_length == ptr->write_buffer_offset);
ptr->write_buffer_offset= 0;
- return sent_length;
+ return return_length;
}
/*