if (ptr->root->flags.no_block == false)
timeout= -1;
- error= poll(&fds, 1, timeout);
+ size_t loop_max= 5;
+ while (--loop_max)
+ {
+ error= poll(&fds, 1, timeout);
- if (error == 1)
- return MEMCACHED_SUCCESS;
- else if (error == 0)
- return MEMCACHED_TIMEOUT;
+ switch (error)
+ {
+ case 1:
+ return MEMCACHED_SUCCESS;
+ case 0:
+ return MEMCACHED_TIMEOUT;
+#if TARGET_OS_LINUX
+ case ERESTART:
+#endif
+ case EINTR:
+ continue;
+ default:
+ ptr->cached_errno= error;
+ memcached_quit_server(ptr, 1);
+
+ return MEMCACHED_FAILURE;
+ }
+ }
/* Imposssible for anything other then -1 */
WATCHPOINT_ASSERT(error == -1);
+ ptr->cached_errno= error;
memcached_quit_server(ptr, 1);
return MEMCACHED_FAILURE;
*/
memcached_callback_st cb= *ptr->root->callbacks;
- memcached_set_processing_input(ptr->root, true);
+ memcached_set_processing_input((memcached_st *)ptr->root, true);
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
memcached_return_t error;
+ memcached_st *root= (memcached_st *)ptr->root;
error= memcached_response(ptr, buffer, sizeof(buffer),
- &ptr->root->result);
+ &root->result);
- memcached_set_processing_input(ptr->root, false);
+ memcached_set_processing_input(root, false);
if (error == MEMCACHED_SUCCESS)
{
for (unsigned int x= 0; x < cb.number_of_callback; x++)
{
- error= (*cb.callback[x])(ptr->root, &ptr->root->result, cb.context);
+ error= (*cb.callback[x])(ptr->root, &root->result, cb.context);
if (error != MEMCACHED_SUCCESS)
break;
}
static inline void memcached_io_cork_push(memcached_server_st *ptr)
{
+ (void)ptr;
#ifdef CORK
if (ptr->root->flags.cork == false || ptr->state.is_corked)
return;
ptr->state.is_corked= true;
WATCHPOINT_ASSERT(ptr->state.is_corked == true);
-#else
- (void)ptr;
#endif
}
static inline void memcached_io_cork_pop(memcached_server_st *ptr)
{
+ (void)ptr;
#ifdef CORK
if (ptr->root->flags.cork == false || ptr->state.is_corked == false)
return;
ptr->state.is_corked= false;
WATCHPOINT_ASSERT(ptr->state.is_corked == false);
-#else
- (void)ptr;
#endif
}
-#ifdef UNUSED
+#if 0 // Dead code, this should be removed.
void memcached_io_preread(memcached_st *ptr)
{
unsigned int x;
{
case EAGAIN:
case EINTR:
+#if TARGET_OS_LINUX
+ case ERESTART:
+#endif
if ((rc= io_wait(ptr, MEM_READ)) == MEMCACHED_SUCCESS)
continue;
/* fall through */
}
ssize_t memcached_io_write(memcached_server_instance_st *ptr,
- const void *buffer, size_t length, char with_flush)
+ const void *buffer, size_t length, bool with_flush)
{
size_t original_length;
const char* buffer_ptr;