_libssh2_wait_socket: detect nothing-to-wait-for
If _libssh2_wait_socket() gets called but there's no direction set to wait for, this causes a "hang". This code now detects this situation, set a 1 second timeout instead and outputs a debug output about it.
This commit is contained in:
parent
588c8946fc
commit
095e9e7b3e
@ -559,6 +559,14 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
|
|||||||
/* figure out what to wait for */
|
/* figure out what to wait for */
|
||||||
dir = libssh2_session_block_directions(session);
|
dir = libssh2_session_block_directions(session);
|
||||||
|
|
||||||
|
if(!dir) {
|
||||||
|
_libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
|
||||||
|
"Nothing to wait for in wait_socket");
|
||||||
|
/* To avoid that we hang below just because there's nothing set to
|
||||||
|
wait for, we timeout on 1 second to also avoid busy-looping
|
||||||
|
during this condition */
|
||||||
|
seconds_to_next = 1;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
struct pollfd sockets[1];
|
struct pollfd sockets[1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user