Add a ping monitor, to prevent/recover from servers silently disconnecting

This commit is contained in:
Firepup Sixfifty 2024-11-14 10:39:10 -06:00
parent 9402a536f7
commit e5a1ac6897
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48
2 changed files with 7 additions and 1 deletions

View file

@ -52,6 +52,7 @@ servers: dict[str, dict[str, Any]] = {
"address": "irc.underworld.no",
"channels": {"#random": 0, "#dice": 0},
"hosts": ["154.sub-174-251-241.myvzw.com"],
"threads": ["pingMon"],
"dnsblMode": "kickban",
},
"replirc": {

View file

@ -148,7 +148,12 @@ def radio(instance: bare.bot) -> NoReturn:
instance.log("Thread while loop broken", "FATAL")
exit(1)
def ping(instance: bare.bot) -> NoReturn:
while 1:
instance.sendraw("PING :keepalive")
sleep(30)
data: dict[str, dict[str, Any]] = {
"radio": {"noWrap": True, "func": radio, "passInstance": True}
"radio": {"noWrap": True, "func": radio, "passInstance": True},
"pingMon": {"noWrap": True, "func": ping, "passInstance": True}
}