it works without explicitly calling event_active.

Regards


On Wed, Nov 20, 2013 at 12:35 PM, Goetz T. Fischer
<[email protected]>wrote:

> hi and thanks for the reply!
>
> does it work for you with or without using event_active?
>
>
> On Tue, 19 Nov 2013 22:38:39 -0800, Himanshu S wrote:
> > Hi,
> > I have been using libevent for exactly same purpose as you have
> described and
> > works fine. Once I detect the connection has gone down, ( I don't use
> timer
> > though, just use the read callback and read fails), I don't connect
> > immediately. I invoke a timer of 1 sec or so and then try connect. Do you
> > check the return code for connect to make sure it is successful? Maybe
> your
> > connect is actually failing since TCP connection is not fully closed yet.
> >
> >
> > On Tue, Nov 5, 2013 at 10:59 PM, Goetz T. Fischer <
> [email protected]>
> > wrote:
> >> good morning/evening/afternoon, whatever matches your timezone :-)
> >>
> >> i've been scratching my head over one issue for some time and couldn't
> find
> >> anything helpful on the net either so here's my last resort i hope.
> >>
> >> i have a unix/c program using, surprise, libevent. it runs 3 events, a
> tcp
> >> client, a tcp listener and a timer. everything works fine. the problem
> now is
> >> that the server to which i connect the tcp client event drops out
> >> occasionally.
> >> because of that i added the timer event to do checks. that works fine,
> too.
> >> now if i notice that the server is down i want to reconnect without
> killing
> >> the
> >> event loop so that the listener is not affected. what i do in case of a
> >> disconnect is close the socket, event_del, event_free. after that i
> connect
> >> the
> >> socket again and then add the event the same way as i do when the
> programs
> >> starts:
> >> evutil_make_socket_nonblocking(so);
> >> client = event_new(base, so, EV_READ|EV_PERSIST, incoming, (void
> *)base);
> >> event_add(client, NULL);
> >>
> >> at this point nothing comes in at all so i tried event_active(client,
> NULL,
> >> NULL) which only works for a second or so meaning i get 3 lines and
> nothing
> >> after that.
> >> now the big question is is it possible to add an event while the main
> loop is
> >> running? and if so what did i miss?
> >>
> >>
> >> any sort of hints would be very much appreciated :-)
> >>
> >>
> >> --
> >> ah-consulting.net
> >> Götz T. Fischer CertIT&Comp
> >> Senior Consultant
> >> Phone: +49(0)7225/98 98 79
> >> eMail: [email protected]
> >> http://www.ah-consulting.net
> >> http://www.ah-webhosting.com
> >> ***********************************************************************
> >> To unsubscribe, send an e-mail to [email protected] with
> >> unsubscribe libevent-users    in the body.
> >
>
> --
> ah-consulting.net
> Götz T. Fischer CertIT&Comp
> Senior Consultant
> Phone: +49(0)7225/98 98 79
> eMail: [email protected]
> http://www.ah-consulting.net
> http://www.ah-webhosting.com
> ***********************************************************************
> To unsubscribe, send an e-mail to [email protected] with
> unsubscribe libevent-users    in the body.
>

Reply via email to