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

Re: Issues with channel callbacks


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

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