Commit Graph

15 Commits

Author SHA1 Message Date
Alexey Sokolov 2f853bee61 A bit more debug output for tdns 2012-03-24 00:36:13 +07:00
Uli Schlachter 1dd8d9bf3e Block all signals in DNS threads
A DNS thread should never handle any kind of signal. The main thread is
responsible for handling signals and it does so without any kind of locking.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-02-19 12:26:19 +01:00
Uli Schlachter 252e6d7151 Threaded DNS: Handle spurious wakeups
As DarthGandalf noticed, POSIX allows spurious wakeups from pthread_cond_wait.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-02-19 12:13:25 +01:00
Uli Schlachter 0bdb18a427 Threaded DNS: Use a thread pool
When a DNS thread is done with its lookup, instead of existing immediately, it
now waits for another DNS lookup to do instead. This avoids the cost of
starting/stopping threads all the time.

To make sure that (for whatever reason) the number of waiting threads doesn't
get too high, threads exit if there are more than two DNS threads idling around
with nothing to do.

Fixes #132.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-02-14 20:28:28 +01:00
Uli Schlachter 233897b3a8 threaded DNS: Remove an unneeded function
This inlines the function into its only caller.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-02-04 14:15:52 +01:00
Uli Schlachter 94c7b04245 Threaded DNS: Remove TDNS mutex
POSIX actually guarantees for us that this white is atomic and thus a partial
write is not allowed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-02-04 14:15:52 +01:00
Uli Schlachter beacc0180c TDNS: Fix a use-after-free-race-with-threads
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-19 19:41:21 +01:00
Alexey Sokolov 937998d4a5 Merge branch 'master' into tdns 2012-01-15 13:12:28 +07:00
Alexey Sokolov ff8065ed32 TDNS: Fix few incompabilities with last Csocket. 2012-01-15 13:11:56 +07:00
Uli Schlachter c87e7cf5ba Update Csocket to e00323f9f18
This breaks API for Csock::SockError()!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-14 11:33:38 +01:00
Un1matr1x 73270ff023 Welcome in 2012 2012-01-01 09:30:19 +01:00
Alexey Sokolov 717d0596e3 Use threads for resolving DNS.
Drop support for c-ares. Though Csocket still supports it, ZNC's
configure script doesn't enable it anymore.

This should fix big brokenness of c-ares library, which tried to
connect via IPv6 even when IPv6 is disabled on the system.

Also should fix github issue #37
2011-12-27 00:29:51 +07:00
Kyle Fuller 200940756b Update Csocket to d7206c6aa88bd7988f 2011-10-21 01:40:36 +00:00
Alexey Sokolov 2c1ca45353 Merge branch 'headers' 2011-09-28 20:15:20 +07:00
Alexey Sokolov afeab4a9e6 Move core .cpp files to src/ 2011-09-23 03:33:13 +07:00