};
int error;
- unlikely (read_or_write == MEM_WRITE) /* write */
+ if (read_or_write == MEM_WRITE) /* write */
+ {
fds.events= POLLOUT;
+ WATCHPOINT_SET(ptr->io_wait_count.write++);
+ }
+ else
+ {
+ WATCHPOINT_SET(ptr->io_wait_count.read++);
+ }
/*
** We are going to block on write, but at least on Solaris we might block
switch (error)
{
case 1:
+ WATCHPOINT_IF_LABELED_NUMBER(read_or_write && loop_max < 4, "read() times we had to loop, decremented down from 5", loop_max);
+ WATCHPOINT_IF_LABELED_NUMBER(!read_or_write && loop_max < 4, "write() times we had to loop, decremented down from 5", loop_max);
+
return MEMCACHED_SUCCESS;
case 0:
return MEMCACHED_TIMEOUT;
+ default:
+ WATCHPOINT_ERRNO(errno);
+ {
+ switch (errno)
+ {
#ifdef TARGET_OS_LINUX
- case ERESTART:
+ case ERESTART:
#endif
- case EINTR:
- continue;
- default:
- ptr->cached_errno= error;
- memcached_quit_server(ptr, true);
+ case EINTR:
+ continue;
+ default:
+ ptr->cached_errno= error;
+ memcached_quit_server(ptr, true);
- return MEMCACHED_FAILURE;
+ return MEMCACHED_FAILURE;
+ }
+ }
}
}
+ if (loop_max == 0 && error == 0)
+ return MEMCACHED_TIMEOUT;
+
/* Imposssible for anything other then -1 */
WATCHPOINT_ASSERT(error == -1);
ptr->cached_errno= error;
{
data_read= read(ptr->fd, ptr->read_buffer, MEMCACHED_MAX_BUFFER);
if (data_read > 0)
+ {
break;
+ }
else if (data_read == -1)
{
ptr->cached_errno= errno;
- memcached_return_t rc= MEMCACHED_UNKNOWN_READ_FAILURE;
+ memcached_return_t rc= MEMCACHED_ERRNO;
switch (errno)
{
case EAGAIN:
for blocking I/O we do not return 0 and for non-blocking case
it will return EGAIN if data is not immediatly available.
*/
+ WATCHPOINT_STRING("We had a zero length read()");
memcached_quit_server(ptr, true);
*nread= -1;
return MEMCACHED_UNKNOWN_READ_FAILURE;
if (sent_length == -1)
{
ptr->cached_errno= errno;
+ WATCHPOINT_ERRNO(errno);
+ WATCHPOINT_NUMBER(errno);
switch (errno)
{
case ENOBUFS: