[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues with channel callbacks


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.

We can't think of a channel as pipe, on which we can poll and the data
stays there until we read it. The polling is always on the whole session
and every channel of it. If there's data to read, we have to work on it
for every channel. At least this is how I understand it...

Till


Follow-Ups:
Re: Issues with channel callbacksg4-lisz@xxxxxxxxxxxx
Re: Issues with channel callbacksTilo Eckert <tilo.eckert@xxxxxxx>
References:
Issues with channel callbacksTilo Eckert <tilo.eckert@xxxxxxx>
Archive administrator: postmaster@lists.cynapses.org