Bugs item #2785173, was opened at 2009-05-01 17:42
Message generated for change (Comment added) made by nobody
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2785173&group_id=125852
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: API
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: channel_read returns LIBSSH2_ERROR_EAGAIN, no data on socket
Initial Comment:
While using libssh2_channel_read_ex(), I found that when the last of the data
has been read, the libssh2_channel_read_ex() may return LIBSSH2_ERROR_EAGAIN,
but a poll() on the socket times out (eventually). I diagnosed this as packets
(channel eof and channel close) in memory, but not processed, so
libssh2_channel_eof() remains false. Root caused as a "single shot" call to
_libssh2_transport_read() in channel_read(). No call to
_libssh2_transport_read() should be made unless the caller continues to call
the function until it returns a non-positive value (0 or negative). This will
prevent it from leaving unprocessed buffers in memory.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2009-05-01 18:49
Message:
The transport function did not return EAGAIN. It processed a full packet
(fullpacket()), and returned the result (the packet type). Because
_libssh2_transport_read() returns after processing just one packet,
additional packets may be waiting (in memory) to be processed by future
calls to _libssh2_transport_read(). To resolve this I changed
channel_read() in channel.c (around line 1777):
Was:
rc = _libssh2_transport_read(session);
Now:
rc = 1;
while (rc > 0)
rc = _libssh2_transport_read(session);
----------------------------------------------------------------------
Comment By: Daniel Stenberg (bagder)
Date: 2009-05-01 18:19
Message:
This explanation is not clear to me. If the reason for the
LIBSSH2_ERROR_EAGAIN is a "single shot" call to _libssh2_transport_read()
in channel_read() then didn't that transport function return EAGAIN? If so,
what good would adding a loop do?
Or perhaps put in another way: can you please provide a patch showing what
you suggest?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2785173&group_id=125852
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
libssh2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libssh2-devel