When the number of hostmasks exceeds 1000 (the hardcoded size of
_patternCache and _hostmaskPatternEqualCache), this triggers
a pathological case in the LRU caches, that causes all calls to be
a cache miss.
This means that on every IRC message received, ircdb.checkIgnored triggers
a recompilation of *all* user hostmasks, which is very expensive
computationally.
This commit stores them in their own cache to prevent them from
expiring.
It's pointless and looks stupid.
It will look even more stupid when we enable multiline, because the
suffixes will be in the middle of the concatenated message.
Otherwise, if some IP addresses don't work (eg. all odd ones), the bot will
consecutively fail because it can't connect, then connect + get STS + reconnect,
then fail again, then connect + get STS, etc.
This is not a regression; this was already forbidden before
23417b0675, and this commit was not
tagged/released yet at the moment I'm writing this one.
echo-message ended up in self.state.capabilities_req even though it wasn't
requested, so the bot was stuck in state:
"Waiting for ACK/NAK of capabilities: {'echo-message'}".
Plugin can opt in to getting echo messages by setting the class attribute
'echo_message = True' if they want to get echos.
This defaults to False in order not to break existing plugins, and because
they usually don't need it (there's outFilter for most cases).
If on an insecure connection: reconnect.
If on a secure connect: store it and do nothing else.
For now, stored STS policies are not read when connecting to an
insecure server.
Fixes c1d3bad64f, which crashed with:
```
ERROR 2020-01-18T01:34:07 Uncaught exception in NickAuth._callCommand:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1337, in _callCommand
irc.errorNoCapability(cap)
File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 544, in errorNoCapability
raise Error()
supybot.callbacks.Error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/supybot/log.py", line 368, in m
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1359, in _callCommand
irc.error(str(e))
File "/usr/local/lib/python3.7/dist-packages/supybot/callbacks.py", line 1065, in error
raise ArgumentError
supybot.callbacks.ArgumentError
```