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

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

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 17 Jun 2009 09:38:23 +0200 (CEST)

On Mon, 15 Jun 2009, Phillip Wu wrote:

> 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?

Oh, right you are!

> 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.

How would you lose data because of this?

> So I think it would be slicker to return LIBSSH2_ERROR_CHANNEL_CLOSED rather
> than 0.
>
> What are your thoughts on this?

I agree with you now. I think.

But we must make sure that we properly drain the incoming data "queue" first
before returning LIBSSH2_ERROR_CHANNEL_CLOSED.

As you're onto this, will you write a patch and see that it works for your
use-case first?

-- 
  / 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
Received on 2009-06-17