← Back to team overview

drizzle-discuss team mailing list archive

Re: libdrizzle: integration with another event loop

 

Eric Day wrote:
One you call set_revents() on a connection, you should stop waiting
for that particular set of events. libdrizzle will call the event
callback function again if it should be set.

Okay, I changed my code to do this and it works just fine. Part of my confusion is that this is *not* what the gearmand example that you sent does. Looking at the code:

http://bazaar.launchpad.net/~gearman-developers/gearmand/trunk/annotate/head:/libgearman-server/gearmand_con.c

the libevent callback _con_ready (line 224) does nothing with the libevent events. The events are set in gearmand_con_watch (line 199) with the EV_PERSIST option, so they will keep firing until explicitly removed. Is this a difference between the libdrizzle and gearmand event implementations?


Similarly, I'm confused how to deregister when a connection is
closed. Is it safe to assume the answer is "you need to deregister
when you close/free the connection"?
De-register? Just remove the event from libevent and drizzle_con_free()
the connection object, this should clean everything up.

I guess my concern is just that there are lots of places in the libdrizzle code where if an error occurs, the fd is closed without my "event manager" code being aware. I don't *think* this will cause any problems though.

Evan

--
Evan Jones
http://evanjones.ca/



Follow ups

References