On Sun, Mar 20, 2016 at 3:01 PM, Azat Khuzhin <[email protected]> wrote: >> > bufferevent_write() just move data from user-passed to bufferevent >> > internal, you can get internal output buffer with >> > bufferevent_get_output() >> >> Ah, indeed, did think about that one in the scope of using the >> evbuffer callbacks, but the problem remains the same at that moment: >> once you have the bufferevent_get_output, one should not alter the >> callbacks for the output buffer of bev. So I'm not sure what that >> would bring me in this case? > > evbuffer callbacks will remain the same until free, but why do you need > them? I've got X bytes of userdata, scattered over Y memory parts, I add them to one evbuffer, using the evbuffer_add_reference. Then I use evbuffer_write to send them to the fd, until it gets a 'wouldblock', from that point on I defer the work via a bufferevent (bufferevent_write_buffer).
But I want to inform the user who sends me X bytes, when these X bytes where actually send (as one action, when they are all out). In first place, I was thinking on using the evbuffer callbacks, but turns out that buffervevent_write_buffer already would call these callbacks (as the original is buffer is drained), and the callbacks of the buffervent's internal outbuf should not be overwritten. Also, even with these callbacks on the internal output buffer of bufferevent, it wouldn't help probably, as 'other data' is also there, so how would you keep track of the right data. So in second approach, I started looking at the cleanup_cb. Would suit my needs I believe, I can keep track of the userdata, but don't have the deferred aspect implemented. So at that moment, I wondered if I was looking at it from a wrong angle, and decided to get in touch :-) /Jan > *********************************************************************** > To unsubscribe, send an e-mail to [email protected] with > unsubscribe libevent-users in the body. *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
