Regd ev_timer

Varun Chandramohan cvaruneng04 at gmail.com
Wed Apr 3 00:54:46 CEST 2013


Hi Jann,

Yeah, thanks for picking that up. Yes I will reset the timer. Just a
question, so at line 78 if I removed if (events & EV_TIMEOUT) { }
check will it be an issue. I dont see anything else calling this call back
apart from this event. May be EV_ERROR perhaps?
Also if you have time revert the code I pasted back to original problem as
stated in my first post and check the result.

Will you be able to tell me theoretically what was going on? I still not
aware of what exactly went wrong. Also I have been
using this manual http://doc.dvgu.ru/devel/ev.html for development. I could
not find ev_now_update() so wondering if there is better
and more update manual with examples to learn from?

Regards,
Varun


On Wed, Apr 3, 2013 at 9:42 AM, Jann Horn <jann+libev at thejh.net> wrote:

> On Wed, Apr 03, 2013 at 09:27:31AM +1100, Varun Chandramohan wrote:
> > Hi Jann,
> >
> > Sorry for psudo code and bad format. I put only the pseudo code because
> it
> > will easier to see if there is a logical flaw.
> >
> > This is not to check for internet connectivity. In my actual code I use
> IP
> > address not resolving. This is just test code so I have the same. Please
> > excuse me.
> >
> > With the changes you suggested
> > This trick with the timer is a bit ugly. Why don't you do it the way it's
> > documented in the manual? Just do
> >
> >     ev_now_update(loop);
> >     ev_timer_set(&ps_hb->timer, DEFAULT_CONNECT_TIMER, 0);
> >
> > (same thing in hb_timeout_handler)
> >
> > This fixes my problem. It seem to work as expected.
>
> Oh, cool, I didn't think that it was more than bad style. :)
>
>
> > Iam pasting my code
> > anyways so that you can take a look and let me know if you see proper use
> > of the libev. Please
> > add any comment. Thanks a lot for your help.
> >
> > My code: http://pastebin.com/Zvzurj2N
>
> Sure. There are two things I can spot, but they're not libev-related:
> 1. After line 78 should be an indent, I think.
> 2. When a connect fails with an errno other than EINPROGRESS, you do a
> sleep()
>    without resetting the timer afterwards. Doesn't sound like a good idea.
>
> _______________________________________________
> libev mailing list
> libev at lists.schmorp.de
> http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20130403/c6ef4147/attachment-0001.html>


More information about the libev mailing list