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>
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>
This fixes a bug where sending anything to a client, such as with
PutModule will fail because it will refer to the new nick before the
client knows about it. The watch module did this.
Default this boolean to true incase there are no networks to loop over. This
will silently drop any network modules for the user, but since there are no
networks anyway it doesn't really matter.
If connecting to a server failed without needing any time for DNS, the connect
timer would busy loop over the networks, because a network re-inserted itself
into the queue and the timer would try the network again.
Fix this by moving the connection queue to a separate instance of std::list when
the timer fires. From then on, we just iterate through that list while networks
which want to try again add themselves to the "real" connection queue instead.
We only have to make sure that any networks that are left in the old connection
queue after the timer is done get prepended to the "real" connection queue.
Signed-off-by: Uli Schlachter <psychon@znc.in>
A CIRCNetwork's destructor removes the network from its associated user's list
of networks. Now that you know this, stare at the diff until you figure out the
problem. Yeah, "ouch".
Signed-off-by: Uli Schlachter <psychon@znc.in>
If user is connected without network, try "default" network first, if it
exists. If not, try "user" network. If it doesn't exist too, just use
the first one.
Also configs converted from old configs have "default" network instead
of "user" one.
Previously, a certificate generated with --makepem expired after a year which is
weird and pointless (come on, it's self-signed!).
Signed-off-by: Uli Schlachter <psychon@znc.in>
The reason for this is so that any messages sent in *status by attaching
a new network will show up after the switched message.
<*status> Switched to efnet
<*status> You are currently disconnected from IRC. Use 'connect' to reconnect.
This fixes#96. When the last user in a partyline channel is deleted, the
channel is deleted, too. This invalidates the iterator used in OnDeleteUser().
This fix is to increase the iterator before the channel can be deleted.
After the above fix, znc still crashed due to another broken use of iterators.
When a network is deleted, it takes all its clients with it (why aren't they
just moved into the "no network"-state?"). However, deleting a CClient removes
it from the network's list of clients via CClient::Disconnect(). This resulted
in another invalid use of iterators.
Signed-off-by: Uli Schlachter <psychon@znc.in>