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.
This means that every reference to my own user will instead show my
clients nickname. This will prevent the client from seeing itself, and
the real nick for your client in the channel.
Send private partyline messages to each client seperately using the
correct nickname for that client. It may differ if they are user clients
or network clients where they are not connected to an IRC server.
I have created macro's for the nickname prefix so this could easily be
changed.
Use 401 instead of 403 for user/channel not found
Fixes#21
After previous commit compiler.cpp depends on python headers, because it
includes them. Therefore g++ tries to write a depend file about them.
If there's no such dir .depend yet, it'll fail.
Thanks to SilverLeo for noticing 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>
At first the test was failing with the following error due to my CXXFLAGS:
conftest.cpp:20:37: error: parameter 'a' set but not used
[-Werror=unused-but-set-parameter]
Then it figured out that -lpthread works, but I wondered why the test for
"-pthread" still fails. This is where I realized that it is testing with C++
compiler, but puts its stuff in $CFLAGS which is just ignored. So a little
search-and-replace later, this now uses $CXXFLAGS.
At this point the results of the tests looked good, but znc failed to link,
because it didn't use -pthread when linking. One little "PTHREAD_LIBS=" later,
that problem was also gone and I can finally commit this. Yay.
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.