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

Re: [Libevent-users] detected a bad network connection for a TCP connection



On Mon, Feb 7, 2011 at 5:15 PM, Ivan Novick <novickivan@xxxxxxxxx> wrote:
> Hello,
>
> I am testing fault tolerance in my application that is written using
> libevent-1.4.6

I'd seriously suggest that you always use the latest stable release,
or at the very least the most recent stable release in the 1.4.x
series.  There have been a lot of bugs fixed since 1.4.6-stable.  (Not
that this affects your question here, but

> The application has a client and server connecting over TCP
>
> and the event is setup like this on the client:
>
> event_set(event, sock, EV_READ | EV_PERSIST, recv_from_server, h);
>
> Then I login to the server and bring down the network interface like this:
>
> ifconfig eth3 down.
>
> libevent on the client does not seem to generate any event for me to
> detect that the network connection is down.
>
> If I was coding all this by hand, without libevent, I would expect to
> be able to detect a disconnection from the socket.

Have you confirmed this?  If there's code using
select/poll/epoll/whatever that shows the result you want, it should
be pretty easy to make Libevent do the right thing here. (In fact,
Libevent should already be doing the right thing here!) And if your OS
reports the socket status change differently, then Libevent can be
made to support it. But if your OS doesn't report it some how, then
Libevent obviously can't tell your app about it.

> Do you know how I can detect the disconnection caused by bringing down
> the interface on the server ... while still using libevent?

If there's a good way to do this, Libevent or no, I'd like to know about it too.

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