Subject: RE: Packet drop on full socket problem

RE: Packet drop on full socket problem

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 7 Oct 2010 13:35:01 +0200 (CEST)

On Thu, 7 Oct 2010, Daniel Stenberg wrote:

> The _libssh2_transport_write() function returns data that it sent, even if
> the amount is not a full SSH packet. We can't allow it to do that. We need
> to keep the application thinking EAGAIN until the full packet has been
> sent, as only when the full packet has been sent we can say that the data
> has actually been sent and we are prepared to get more data to send.

It was slightly incorrect there, but the main point was right.

  _libssh2_transport_write() always just returns success or EAGAIN, the mistake
was done in channel_write(). It would continue to try sending more data after
a successful call to _libssh2_transport_write(), which would risk that it
would first send data and then get EAGAIN back, and our API can't return back
such info.

Now, _libssh2_channel_write() will return success immediately when a SSH
packet has been sent off successfully. This short remove all problems with
short sends and in fact I remove the transport_drain() function again since
adding/using that was a mistake.

Please, get the latest git version and have a try and see if things work
better now. If not, I think getting a trace output for the problem will be
very useful!

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-10-07