Re: Regd ev_timer

2013-04-03 Thread Marc Lehmann
On Wed, Apr 03, 2013 at 11:56:09AM +1100, Varun Chandramohan wrote: > Thanks Marc, that seem clear. Would you be able to answer the question I > asked Jann about the timer. Well, did you try reading my answer? Hint: it's in the documentation, and ev_now_update is a good starting point. If anyth

Re: Regd ev_timer

2013-04-02 Thread Varun Chandramohan
Thanks Marc, that seem clear. Would you be able to answer the question I asked Jann about the timer. I have pasted my code in previous post that can be compiled directly. It works now but if I just remove ev_now_update(loop) from both my handlers then the code goes bad and I get timeout events ev

Re: Regd ev_timer

2013-04-02 Thread Marc Lehmann
On Wed, Apr 03, 2013 at 09:54:46AM +1100, Varun Chandramohan wrote: > 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? The revents should only contain t

Re: Regd ev_timer

2013-04-02 Thread Jann Horn
On Wed, Apr 03, 2013 at 09:54:46AM +1100, Varun Chandramohan wrote: > 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 >

Re: Regd ev_timer

2013-04-02 Thread Varun Chandramohan
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 th

Re: Regd ev_timer

2013-04-02 Thread Jann Horn
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 n

Re: Regd ev_timer

2013-04-02 Thread Varun Chandramohan
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 t

Re: Regd ev_timer

2013-04-01 Thread Jann Horn
On Tue, Apr 02, 2013 at 02:48:05PM +1100, Varun Chandramohan wrote: > Hi Folks, > > Iam trying to understand the timer behaviour using a simple program. Let me > first post the pseudo code. Why pseudo code? Why not your real code? If you have made a mistake that's not visible in your pseudo code

Regd ev_timer

2013-04-01 Thread Varun Chandramohan
Hi Folks, Iam trying to understand the timer behaviour using a simple program. Let me first post the pseudo code. /*global */ #define DEFAULT_CONNECT_TIMER 7.0 struct ps_hb { ev_io io; ev_timer timer; int sd; struct sockaddr_in serveraddr; }ps_hb; int init_ps(struct ps_hb