[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Ability to shutdown() socket with bufferevents?



> Right now there's no way to make a bufferevent call shutdown() itself,
> but what if you have a write handler on the client bufferevent just
> call shutdown() manually on the fd to send a FIN when the write buffer
> is empty?  You can get the fd with bufferevent_get_fd().
How can I check to see if the write buffer is empty?   Obviously I'd
only want to indicate a shutdown() after all my data had been
processed *and* the buffer is empty.

Inside my write callback, when I call
struct evbuffer *output = bufferevent_get_output(bev);
len=evbuffer_get_length(output);

I always get a return length of 0.   (I also tried to check the input
buffer, but its 0 as well). I assumed it would indicate how much
data was left in the backing evbuffer that hadn't been written to the
O/S socket buffers.   In that case I'd want to indicate my shutdown
after I had written all data to the backing evbuffer *and* the
evbuffers were empty.   Am I missing something obvious?

Will the flush() sequence I mentioned before be what I'd want to use
once its implemented?   Any timeline if thats the case?  (2.1 I assume
since 2.0 features are locked).

Thanks!
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.