Subject: follow up: libssh2_channel_read returns 0 when channel has been closed

follow up: libssh2_channel_read returns 0 when channel has been closed

From: Phillip Wu <Phillip.Wu_at_lands.nsw.gov.au>
Date: Wed, 17 Jun 2009 17:01:27 +1000

Is it not possible for a non-blocking read to return 0 when there is no
data to read but in actual fact the remote side has sent an EOF?

In non-blocking mode when I get a 0, I could confirm that eof has been
sent by calling libssh2_channel_eof.
There could be a slight chance that I could loose data during the time
delay from the eof call.

So I think it would be slicker to return LIBSSH2_ERROR_CHANNEL_CLOSED
rather than 0.

What are your thoughts on this?
 
-----Original Message-----
From: Daniel Stenberg [mailto:daniel_at_haxx.se]
Sent: Sunday, 14 June 2009 6:48 AM
To: libssh2 development
Subject: Re: libssh2_channel_read returns 0 when channel has been closed

On Fri, 12 Jun 2009, Phillip Wu wrote:

> I have looked at the code for channel_read and it appears that it
returns 0
> when the remote end has closed the channel:

...

> I think that the channel_read routine should return
> LIBSSH2_ERROR_CHANNEL_CLOSED rather than 0.

But isn't a return code of 0 basically implying that the end of the
transfer
is reached anyway? Can it actually return 0 in any other situation?

-- 
  / daniel.haxx.se
------------------------------------------------------------------------
------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
***************************************************************
This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient, please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily the views of the Department of  Lands. This email message has been swept by MIMEsweeper for the presence of computer viruses.
***************************************************************
Please consider the environment before printing this email.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-06-17