Skip to content

Instantly share code, notes, and snippets.

@nicktelford
Created May 24, 2011 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicktelford/988485 to your computer and use it in GitHub Desktop.
Save nicktelford/988485 to your computer and use it in GitHub Desktop.
goto loop in libmemcached - criminal!
test_connect:
if (connect(ptr->fd,
(struct sockaddr *)&servAddr,
sizeof(servAddr)) < 0)
{
switch (errno)
{
case EINPROGRESS:
case EALREADY:
case EINTR:
goto test_connect;
case EISCONN: /* We were spinning waiting on connect */
break;
default:
WATCHPOINT_ERRNO(errno);
ptr->cached_errno= errno;
return MEMCACHED_ERRNO;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment