{
goto handle_retry;
}
- else if (error != 1 || fds[0].revents & POLLERR)
+ else if (error != 1 && fds[0].revents & POLLERR)
{
ptr->cached_errno= errno;
WATCHPOINT_ERRNO(ptr->cached_errno);
WATCHPOINT_ASSERT(command);
if ((rc= memcached_connect(ptr)) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
return rc;
+ }
sent_length= memcached_io_write(ptr, command, command_length, with_flush);
return MEMCACHED_SUCCESS;
/* in case of death shutdown to avoid blocking at close() */
- r= shutdown(ptr->fd, SHUT_RDWR);
+ if (1)
+ {
+ r= shutdown(ptr->fd, SHUT_RDWR);
#ifdef HAVE_DEBUG
- if (r && errno != ENOTCONN)
- {
- WATCHPOINT_NUMBER(ptr->fd);
- WATCHPOINT_ERRNO(errno);
- WATCHPOINT_ASSERT(errno);
- }
+ if (r && errno != ENOTCONN)
+ {
+ WATCHPOINT_NUMBER(ptr->fd);
+ WATCHPOINT_ERRNO(errno);
+ WATCHPOINT_ASSERT(errno);
+ }
#endif
+ }
r= close(ptr->fd);
#ifdef HAVE_DEBUG
goto error;
}
+ /* Send command header */
rc= memcached_do(&ptr->hosts[server_key], buffer, write_length, 0);
if (rc != MEMCACHED_SUCCESS)
goto error;
+ /* Send command body */
if ((sent_length= memcached_io_write(&ptr->hosts[server_key], value, value_length, 0)) == -1)
{
rc= MEMCACHED_WRITE_FAILURE;