libev callbacks getting called for same socket fd and same event

Marc Lehmann schmorp at
Wed Jan 11 05:57:15 CET 2012

On Wed, Jan 11, 2012 at 05:29:02AM +0100, Sandeep <sandeep at> wrote:
> Though I am doing this, libev is repeatedly calling me with same socket
> fd and event, recursively. Thus some of my fd's will never be completed,
> thus getting stuck.

I don't believe this is true - can you make a testcase where you actually
do read froma scoket (for EV_READ) and you are still getting called even
though there is no data there?

> Please help me what might be going wrong. I am using ev_io and ev_timer
> functions (init/start/stop).

Hard to say what you are doing rong - are you sure curl actually acts on the
socket, i.e. does read (or write)? If curl doesn't read or write, then it
will naturally be called again - curl should tell you to stop reading in that

I faintly remember other people having had trouble with curl (list
archives might know more), and my own personal experience with curl is
that it is very low quality and often only partially implemented, so maybe
you are doing everything right, and curl is to blame.

Or maybe you misinterpret the events from curl - maybe curl indeed tells
you it's no longer interested in a socket but you fail to execute this wish?

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list