Fix 1d1bb2a2a issue by defining init in DelugeRPCProtocol

This commit is contained in:
Calum Lind 2017-03-14 19:29:45 +00:00
parent 1d1bb2a2a7
commit 5348465e60
1 changed files with 5 additions and 1 deletions

View File

@ -108,6 +108,11 @@ class ServerContextFactory(object):
class DelugeRPCProtocol(DelugeTransferProtocol): class DelugeRPCProtocol(DelugeTransferProtocol):
def __init__(self):
super(DelugeRPCProtocol, self).__init__()
# namedtuple subclass with auth_level, username for the connected session.
self.AuthLevel = namedtuple('SessionAuthlevel', 'auth_level, username')
def message_received(self, request): def message_received(self, request):
""" """
This method is called whenever a message is received from a client. The This method is called whenever a message is received from a client. The
@ -159,7 +164,6 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
log.info('Deluge Client connection made from: %s:%s', log.info('Deluge Client connection made from: %s:%s',
peer.host, peer.port) peer.host, peer.port)
# Set the initial auth level of this session to AUTH_LEVEL_NONE # Set the initial auth level of this session to AUTH_LEVEL_NONE
self.AuthLevel = namedtuple('SessionAuthlevel', 'auth_level, username')
self.factory.authorized_sessions[ self.factory.authorized_sessions[
self.transport.sessionno] = self.AuthLevel(AUTH_LEVEL_NONE, '') self.transport.sessionno] = self.AuthLevel(AUTH_LEVEL_NONE, '')