libssh2_wait_socket: reset error code to "leak" EAGAIN less

Since libssh2 often sets LIBSSH2_ERROR_EAGAIN internally before
_libssh2_wait_socket is called, we can decrease some amount of
confusion in user programs by resetting the error code in this function
to reduce the risk of EAGAIN being stored as error when a blocking
function returns.
This commit is contained in:
Daniel Stenberg 2010-07-18 19:47:21 +02:00
parent 2afa5b2dc2
commit 697b4e8ed7

View File

@ -543,6 +543,12 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
int seconds_to_next;
int dir;
/* since libssh2 often sets EAGAIN internally before this function is
called, we can decrease some amount of confusion in user programs by
resetting the error code in this function to reduce the risk of EAGAIN
being stored as error when a blocking function has returned */
session->err_code = LIBSSH2_ERROR_NONE;
rc = libssh2_keepalive_send (session, &seconds_to_next);
if (rc < 0)
return rc;