[Libssh] Minor problem with polling/EOF

Matt Lawson lawson08 at yahoo.com
Wed Mar 5 20:31:25 CET 2008


> > does Rodolphe Rocca's patch posted on this list
> > correct your problem ?

> a while, as it was a slippery bug.

Ha!  That didn't take long...  What I decided to do
was rebuild the library based on yesterday
(2008-03-04) svn snapshot.  So all those patches
should be incorporated, as well as quite a lot of
other changes since the 0.2 release (maybe a 0.2.1 or
0.2a release would be nice?)

Well that didn't fix my bug.  It behaves the same as
before.  What I do is this:

pollRc = channel_poll(channel,0);
if (pollRc>0) {
rc=channel_read_nonblocking(channel,buf,pollRc,0);
// WHOOPS!!  pollRc=1, rc=0
}

I can do that nonblocking read till the cows come home
and the state never changes, always polls 1 but reads
zero.  During this condition, channel_is_open()
indicates the channel is still open (!=0) but
channel_is_eof() indicates that it is at EOF (!=0)

My workaround is to expose the channel_is_eof()
function, as this is the only way I know that the
channel is [should] close.

Am I wrong to expect that the bytes reported by the
poll should be immediately readable?

This situation doesn't happen everytime, maybe 50% of
the time, so it's easily repeatable but not every
single time.

Thx
- matt




      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs



More information about the Libssh mailing list