[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issues with channel callbacks
[Thread Prev] | [Thread Next]
- Subject: Re: Issues with channel callbacks
- From: Tilo Eckert <tilo.eckert@xxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Mon, 25 Feb 2019 15:21:34 +0100
- To: libssh@xxxxxxxxxx
Am 25.02.2019 um 11:51 schrieb g4-lisz@xxxxxxxxxxxx: > On 25.02.19 11:18, Tilo Eckert wrote: > >> 3) My data callback is executed exactly once for every received channel >> data packet. I think this should be changed to be more user-friendly: >> The data callback should be executed repeatedly until it consumed all >> available bytes or 0 (i.e. the callback signals that there is not enough >> data to process). That would make it easier to implement custom protocol >> handlers via callbacks. For example, a data callback that processes a >> single line of text per call would no longer require a loop in the >> callback function, leading to code that is easier to read. > > Yes this would be very convenient on the client's side. But I also > understand that this is quite complicated to implement on the lib's > side, because it needed buffering of the data to read for an undefined > period. Buffering is already taken care of in channel_rcv_data(). If your custom callback does not consume all data received on a channel, the remaining data is passed to you again when more channel data arrives. Regards, Tilo Eckert
Issues with channel callbacks | Tilo Eckert <tilo.eckert@xxxxxxx> |
Re: Issues with channel callbacks | g4-lisz@xxxxxxxxxxxx |