www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: [libssh2] #256: many writes, congested link -> LIBSSH2_ERROR_BAD_USE, stuck

Re: [libssh2] #256: many writes, congested link -> LIBSSH2_ERROR_BAD_USE, stuck

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Tue, 05 Feb 2013 01:23:46 -0000

#256: many writes, congested link -> LIBSSH2_ERROR_BAD_USE, stuck
---------------------+-------------------
  Reporter: ncm | Owner:
      Type: defect | Status: new
  Priority: normal | Milestone: 1.4.3
 Component: misc | Version: 1.4.2
Resolution: | Keywords:
Blocked By: | Blocks:
---------------------+-------------------

Comment (by ncm):

 During thorough testing, we have logged this
 happening with keepalive packets, as seen in #254.
 The attached patch fixes that too. It is needed
 in addition to the patch proposed in #250 to fix
 that failure completely.

 I should explain the logic of the patch.
 Control messages are treated a little differently
 from payload messages. In either case, when a
 short write has occurred, _transport_send can
 only begin by sending what it can of the saved
 ciphertext of the rest of the pending message,
 before considering the current one.

 If the pending text was from a control message,
 libssh2 will be making no attempt to re-try it.
 Still, part of it has already gone out, so the
 rest must be handled now, whatever the current
 message is for. After that, the current message
 can be processed normally, possibly resulting in
 another short write.

 If the pending text was from a payload message,
 things are a little trickier. If this call is for a
 control message or for a different channel, we
 must simply return _EAGAIN: if the pending text
 were to drain successfully, then when the client
 calls _write() later with the same payload (note
 that it will have gotten _EAGAIN on the previous
 try), that payload would be sent twice. If this
 call is for the same payload, we can just try
 again to drain it, and report the result.

-- 
Ticket URL: <https://trac.libssh2.org/ticket/256#comment:1>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-02-05

the libssh2 team