~avsej/libmemcached/fix-binary-increment-with-prefix

« back to all changes in this revision

Viewing changes to libmemcached/io.cc

  • Committer: Brian Aker
  • Date: 2011-06-24 20:09:30 UTC
  • mfrom: (929.1.155 libmemcached-build)
  • Revision ID: brian@tangent.org-20110624200930-m268yogmnpyzs3qj
Merge in trunk. Updates to manual/update to latest libtest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
  fds.fd= ptr->fd;
58
58
  fds.events= POLLIN;
59
59
 
60
 
  int error;
61
 
 
62
60
  if (read_or_write == MEM_WRITE) /* write */
63
61
  {
64
62
    fds.events= POLLOUT;
86
84
    }
87
85
  }
88
86
 
 
87
  if (ptr->root->poll_timeout == 0) // Mimic 0 causes timeout behavior (not all platforms do this)
 
88
  {
 
89
    return memcached_set_error(*ptr, MEMCACHED_TIMEOUT, MEMCACHED_AT);
 
90
  }
 
91
 
89
92
  size_t loop_max= 5;
90
93
  while (--loop_max) // While loop is for ERESTART or EINTR
91
94
  {
92
 
    if (ptr->root->poll_timeout) // Mimic 0 causes timeout behavior (not all platforms do this)
93
 
    {
94
 
      error= poll(&fds, 1, ptr->root->poll_timeout);
95
 
    }
96
 
    else
97
 
    {
98
 
      error= 0;
99
 
    }
100
95
 
 
96
    int error= poll(&fds, 1, ptr->root->poll_timeout);
101
97
    switch (error)
102
98
    {
103
99
    case 1: // Success!
145
141
    }
146
142
  }
147
143
 
148
 
  /* Imposssible for anything other then -1 */
149
 
  WATCHPOINT_ASSERT(error == -1);
150
144
  ptr->cached_errno= get_socket_errno();
151
145
  memcached_quit_server(ptr, true);
152
146
 
619
613
    return NULL;
620
614
  }
621
615
 
622
 
  switch (poll(fds, host_index, memc->poll_timeout))
 
616
  int error= poll(fds, host_index, memc->poll_timeout);
 
617
  switch (error)
623
618
  {
624
619
  case -1:
625
620
    memcached_set_errno(*memc, get_socket_errno(), MEMCACHED_AT);