mirror of
https://github.com/brmlab/brmdoor_libnfc.git
synced 2025-06-07 16:14:01 +02:00
Reconnect logging
This commit is contained in:
parent
8b60c85658
commit
6cb2cb62f1
1 changed files with 6 additions and 1 deletions
|
@ -226,6 +226,7 @@ class IrcThread(threading.Thread):
|
|||
:returns true if connection was successful
|
||||
"""
|
||||
try:
|
||||
logging.info("IRC connect attempt")
|
||||
ssl_factory = irc.connection.Factory(wrapper=ssl.wrap_socket)
|
||||
self.reactor = irc.client.Reactor()
|
||||
self.connection = self.reactor.server().connect(
|
||||
|
@ -237,6 +238,7 @@ class IrcThread(threading.Thread):
|
|||
connect_factory=ssl_factory if self.useSSL else lambda sock: sock,
|
||||
)
|
||||
|
||||
logging.info("IRC connect successful")
|
||||
return True
|
||||
except irc.client.ServerConnectionError, e:
|
||||
logging.error("Could not connect to IRC server: %s", e)
|
||||
|
@ -252,6 +254,7 @@ class IrcThread(threading.Thread):
|
|||
return self.connection.topic(channel, newTopic)
|
||||
|
||||
def onConnect(self, connection, event):
|
||||
logging.info("Joining channels: %s", self.channels)
|
||||
for channel in self.channels:
|
||||
connection.join(channel)
|
||||
|
||||
|
@ -259,7 +262,9 @@ class IrcThread(threading.Thread):
|
|||
logging.info("Disconnected, waiting for %s seconds before reconnect", self.reconnectDelay)
|
||||
self.setConnected(False)
|
||||
time.sleep(self.reconnectDelay)
|
||||
self.setConnected(self.connect())
|
||||
reconnected = self.connect()
|
||||
logging.info("IRC reconnect attempt success: %s", reconnected)
|
||||
self.setConnected(reconnected)
|
||||
|
||||
def onJoin(self, connection, event):
|
||||
nick, _ = event.source.split("!", 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue