Reformat legacy project
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
from json import dumps, loads
|
||||
|
||||
from twisted.internet.protocol import Factory, Protocol
|
||||
|
||||
import main
|
||||
from twisted.internet.protocol import Factory, Protocol
|
||||
from utils.logging.log import log, warn
|
||||
|
||||
validTypes = [
|
||||
@@ -118,7 +117,9 @@ class Relay(Protocol):
|
||||
parsed["hello"] == main.tokens[parsed["key"]]["hello"]
|
||||
and main.tokens[parsed["key"]]["usage"] == "relay"
|
||||
):
|
||||
self.sendMsg({"type": "hello", "hello": main.tokens[parsed["key"]]["counter"]})
|
||||
self.sendMsg(
|
||||
{"type": "hello", "hello": main.tokens[parsed["key"]]["counter"]}
|
||||
)
|
||||
self.authed = True
|
||||
else:
|
||||
self.transport.loseConnection()
|
||||
@@ -133,7 +134,10 @@ class Relay(Protocol):
|
||||
|
||||
def connectionLost(self, reason):
|
||||
self.authed = False
|
||||
log("Relay connection lost from %s:%s -- %s" % (self.addr.host, self.addr.port, reason.getErrorMessage()))
|
||||
log(
|
||||
"Relay connection lost from %s:%s -- %s"
|
||||
% (self.addr.host, self.addr.port, reason.getErrorMessage())
|
||||
)
|
||||
if self.addr in main.relayConnections.keys():
|
||||
del main.relayConnections[self.addr]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user