There was a race where threads were themselves responsible for increasing the
counter for the number of running threads. This left an open window where the
thread was already started, but our counter was not yet increased. The effect of
this race would be that we start more threads than we should.
Fix this by increasing the counter before actually starting new worker threads.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This adds CThreadPool::cancelJob() and cancelJobs() which can cancel a set of
jobs synchronously. These functions only return when the job was successfully
cancelled.
It tries to cancel the jobs as quickly as possible, skipping any callbacks on
CJob that were not yet called. A job that is already running can use
CJob::wasCancelled() to check if it should quit.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This is needed to "get rid" of the C++ default implementation. Yes, I know that
this can be done way nicer with C++11...
Signed-off-by: Uli Schlachter <psychon@znc.in>
UnrealIRCd (at least version Unreal3.2.10+) sends numerics 307 and 379 on whois if the client is an IRCop.
These are non-rfc and they can be seen documented here: https://www.alien.net.au/irc/irc2numerics.html
this fixes an annoying bug where two separate log files will be written
if an irc client sends to channel #Foobar and another irc client sends
to channel #foobar.
Currently the connection timeout handling of znc uses three magic numbers, each
of which is at least repeated in two unrelated places. This commits defines the
numbers in CIRCNetwork and makes the other places just use this number.
This also renames PING_TIMEOUT to PING_FREQUENCY because I feel that describes
this constant better.
I am not really happy about the name NO_TRAFFIC_TIMEOUT that is used for the
real timeout, but I couldn't think of a better name. PING_TIMEOUT isn't good
because that sounds like the time between sending a PING and the resulting
timeout.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This patch splits CUserTimer into two other timers:
CIRCNetworkPingTimer: This timer sends PING messages to connected
client's and IRC servers.
CIRCNetworkJoinTimer: This timer enforces the MaxJoin setting by only
allowing a specified amount of channels to join at the same time.
JoinChans() is modified to reset the ping timer once we hit the MaxJoin.
This allows us to call it from any function without breaking the timing
logic.
Before it shown the right result even with wrong path (without prefix),
but it worked only with ZNC directly, not via reverse proxy.
Now it won't work with ZNC directly too.
Further improvements to autoop module:
* Tabulate the data vertically with a new column for each hostname
* Rename table column to Hostmasks
* <mask>,[<mask>] inside help for AddHosts
* Help for AddUser updated
Added support for multiple comma separated hostmasks per user. Added new commands to add and remove hostmasks. Kept the table column names the same so as to not break back-compatability.
I have tested adding and removing several hostmasks for multiple users and checked that it does auto-op them correctly, looks good!