Subject: Re: [libssh2] Blocking read returns PACKET_EAGAIN if not enough data is available?

Re: [libssh2] Blocking read returns PACKET_EAGAIN if not enough data is available?

From: Eberhard Mattes <em-libssh2_at_online.ms>
Date: Tue, 08 May 2007 14:27:20 +0200

Setting

   blocksize = 5;

in libssh2_packet_read() is not correct if multiple calls of
libssh2_packet_read() are required to read a complete unencrypted packet.

Suppose a packet of length 22 arrives in two parts of 20 and 2 bytes,
respectively. (Ie, the first recv() call will return 20, the second one will
return 2.) The first call to libssh2_packet_read() will consume the first 20
bytes, the next call to libssh2_packet_read() will return PACKET_EAGAIN as it
receives 2 instead of 5 bytes, and all further calls will return PACKET_EAGAIN
(or block) as they will receive no data at all.

Eberhard

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-05-08