Subject: Re: libssh2_sftp_init() hangs with zlib compression turned on

Re: libssh2_sftp_init() hangs with zlib compression turned on

From: Gebi Miguel <gebi.miguel_at_gmail.com>
Date: Mon, 13 Jan 2020 13:25:52 -0800

Thank you very much for your quick response, Peter, I greatly appreciate it!

If the line I've added to sftp_write_nonblock.c ...

libssh2_trace (session, ~0);

... doesn't enable transport layer tracing, could you please let me know how I would go about this?
I've looked at the code some more. So the code example sftp_write_nonblock.c is calling the function libssh2_sftp_init() (in libSSH2's sftp.c) where libssh2_sftp_init() calls sftp_init(). In sftp_init() I'm getting to this snippet:

if(session->sftpInit_state == libssh2_NB_state_sent2) {
/* sent off what's left of the init buffer to send */
rc = _libssh2_channel_write(session->sftpInit_channel, 0,
session->sftpInit_buffer +
session->sftpInit_sent,
9 - session->sftpInit_sent);

Moving on into _libssh2_channel_write() it appears that there are nine bytes to send, as mentioned in the last line of the debug output "Writing 9 bytes on channel 0/0, stream #0". In _libssh2_channel_write() I get to this point:

/* drain the incoming flow first, mostly to make sure we get all
* pending window adjust packets */
do
rc = _libssh2_transport_read(session);
while(rc > 0);

_libssh2_transport_read() eventually calls _libssh2_recv() where things get stuck inside the call to recv(). The question I have is why - if there is no inbound data to "drain" - recv() doesn't return with SOCKET_ERROR and WSAEWOULDBLOCK. Is the socket created in "sftp_write_nonblock.c" for any purpose or any period of time used in blocking mode?

_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2020-01-13