[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] What is the best way to detect a client socket disconnect?
Hi Nick,
That was >exactly< it - if I remove my bufferevent_free( bev ) from
echo_event_cb() and call it when I intend to cut-off, the
echo_event_cb() gets invoked.
TYVM.
- Ken
On 11/25/10, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
>
> FWICT, your code isn't really simulating a cutoff: the file descriptor
> allocated for the client bufferevent at line 128 is never actually
> closed, since you neither close the socket nor free the bufferevent.
> (There's a bufferevent_free call in client_event_cb, but it will never
> get invoked, unless the server closes the connection or causes an
> error, I think.) Thus, sockfd won't get automatically freed until the
> entire process exits: just exiting the client thread isn't enough to
> make anything happen to it.
>
> hth,
> --
> Nick
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users in the body.
>
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.