]> arthur.barton.de Git - ngircd-alex.git/commit
Correctly handle asynchronously re-established server links
authorAlexander Barton <alex@barton.de>
Fri, 8 Jun 2012 23:03:48 +0000 (01:03 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 8 Jun 2012 23:03:48 +0000 (01:03 +0200)
commit684e50f0a4d827965b61c4b9feeda403ec3c3b87
tree4285dd2208ab453a5b25c08880f67d93b6c8029a
parent4a90959cb563e7c6ca57d32779074b448982c94f
Correctly handle asynchronously re-established server links

Don't try to establish an outgoing server link after DNS lookup when this
server re-connected on its own in the meantime.
In addition, log a warning message if we try to update the connection
index of an already connected server structure -- and ignore it.

Up to now, both behaviour could lead to a race when the remote server
connects to this daemon while it still prepares the outgoing connection:

 - The local server prepares the new outgoing connection ...
 - in the meantime the remote server becomes connected and registered.
 - Now the new outgoing connection overwrites the (correct) socket handle,
 - then the 2nd connection becomes disconnected: "already registered",
 - and the 1st connection becomes unhandled ("gets lost") because the
   configuration structure is reset because of the wrong socket handle.

This patch hopefully fixes all these problems.
src/ngircd/conf.c
src/ngircd/conn.c