reconnecting a plugin

Edward Rudd erudd at
Mon Dec 3 16:48:17 UTC 2007


Franky wrote:
> Franky Van Liedekerke wrote:
> Ok, even more testing reveals the error:
> the EpollEventLoop function in does a epoll_ctl on the file
> descriptors in %OtherFds, but this is only done once, before the
> while(1) loop. So, adding other filedescriptors later on just fails
> because epoll_ctl is never executed again. The same is valid for KQueue
> btw, but not for the normal PollEventLoop, where this happens within the
> while(1) loop.


> fixes it for Epoll (same for KQueue). I'm not checking the return code
> of epoll_ctl because of the warnings it would create for already
> existing and controlled fd's.
> An even better solution would be to add the epoll and KQueue codes to
> the function AddOtherFds, so the epoll_ctl isn't executed every time.
> Some comments from the Danga::Socket author would be nice here ... Brad?
> Franky

I've attached a diff for Danga::Socket-1.57 that *fixes* OtherFds set of
functions to alter the epoll and KQueue queues while adding/removing
fds. (added a DelOtherFds method too)

I modified AddOtherFds to first delete the FD from the epoll or kqueue
queues and then add them back in.

I also modified OtherFds to delete existing Fds and then add the
replacement set of Fds if the user does a full replacement.

I also added in a DelOtherFds method (which is used by the other two
functions now) which deletes the listed FDs.

I left the beginning Queue adds in the EpollEventLoop and
KQueueEventLoop, so any OtherFds added before the queue loop is started
will be added.

I have tested and this will work with an un-modified djabberd (as I
remove the socket before adding) though for *cleanliness* a call to
DelOtherFds should probably be added in the _stop_listener method.

Brad? any input on my patch?
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Danga.diff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: erudd.vcf
Type: text/x-vcard
Size: 284 bytes
Desc: not available
Url : 

More information about the Djabberd mailing list