Don't always clear write direction blocking flag
When libssh2_transport_write() is called to continue sending a partially sent packet the write direction flag must not be cleared until the previous packet has been completely sent, or the app would hang if the packet still isn't sent completely, since select() gets called by the internal blocking emulation layer in libssh2 but would then not be watching the socket for writability. Clear the flag only once processing of previous packet data is complete and a new packet is about to be prepared.
This commit is contained in:
parent
e642e2c202
commit
7317edab61
@ -671,15 +671,15 @@ _libssh2_transport_write(LIBSSH2_SESSION * session, unsigned char *data,
|
||||
|
||||
debugdump(session, "libssh2_transport_write plain", data, data_len);
|
||||
|
||||
/* default clear the bit */
|
||||
session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_OUTBOUND;
|
||||
|
||||
/* FIRST, check if we have a pending write to complete */
|
||||
rc = send_existing(session, data, data_len, &ret);
|
||||
if (rc || ret) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* default clear the bit */
|
||||
session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_OUTBOUND;
|
||||
|
||||
encrypted = (session->state & LIBSSH2_STATE_NEWKEYS) ? 1 : 0;
|
||||
|
||||
/* check if we should compress */
|
||||
|
Loading…
x
Reference in New Issue
Block a user