Rename protocol_keys ssl->telnet/ssl, websocket->webclient/websocket, ajax/comet->webclient/ajax.

This commit is contained in:
Griatch 2018-01-27 21:54:46 +01:00
parent b0168ac7fe
commit 9ed293b805
6 changed files with 10 additions and 6 deletions

View file

@ -90,6 +90,7 @@ class SshProtocol(Manhole, session.Session):
starttuple (tuple): A (account, factory) tuple. starttuple (tuple): A (account, factory) tuple.
""" """
self.protocol_key = "ssh"
self.authenticated_account = starttuple[0] self.authenticated_account = starttuple[0]
# obs must not be called self.factory, that gets overwritten! # obs must not be called self.factory, that gets overwritten!
self.cfactory = starttuple[1] self.cfactory = starttuple[1]

View file

@ -34,8 +34,8 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.protocol_name = "telnet"
super(TelnetProtocol, self).__init__(*args, **kwargs) super(TelnetProtocol, self).__init__(*args, **kwargs)
self.protocol_key = "telnet"
def connectionMade(self): def connectionMade(self):
""" """
@ -49,7 +49,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
# this number is counted down for every handshake that completes. # this number is counted down for every handshake that completes.
# when it reaches 0 the portal/server syncs their data # when it reaches 0 the portal/server syncs their data
self.handshakes = 8 # suppress-go-ahead, naws, ttype, mccp, mssp, msdp, gmcp, mxp self.handshakes = 8 # suppress-go-ahead, naws, ttype, mccp, mssp, msdp, gmcp, mxp
self.init_session(self.protocol_name, client_address, self.factory.sessionhandler) self.init_session(self.protocol_key, client_address, self.factory.sessionhandler)
# add this new connection to sessionhandler so # add this new connection to sessionhandler so
# the Server becomes aware of it. # the Server becomes aware of it.
self.sessionhandler.connect(self) self.sessionhandler.connect(self)

View file

@ -67,7 +67,7 @@ class SSLProtocol(TelnetProtocol):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(SSLProtocol, self).__init__(*args, **kwargs) super(SSLProtocol, self).__init__(*args, **kwargs)
self.protocol_name = "ssl" self.protocol_key = "telnet/ssl"
def verify_or_create_SSL_key_and_cert(keyfile, certfile): def verify_or_create_SSL_key_and_cert(keyfile, certfile):

View file

@ -31,6 +31,9 @@ class WebSocketClient(Protocol, Session):
""" """
Implements the server-side of the Websocket connection. Implements the server-side of the Websocket connection.
""" """
def __init__(self, *args, **kwargs):
super(WebSocketClient, self).__init__(*args, **kwargs)
self.protocol_key = "webclient/websocket"
def connectionMade(self): def connectionMade(self):
""" """

View file

@ -298,7 +298,7 @@ class AjaxWebClientSession(session.Session):
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.protocol_name = "ajax/comet" self.protocol_key = "webclient/ajax"
super(AjaxWebClientSession, self).__init__(*args, **kwargs) super(AjaxWebClientSession, self).__init__(*args, **kwargs)
def get_client_session(self): def get_client_session(self):

View file

@ -47,8 +47,8 @@ class Session(object):
a new session is established. a new session is established.
Args: Args:
protocol_key (str): By default, one of 'telnet', 'ssh', protocol_key (str): By default, one of 'telnet', 'telnet/ssl', 'ssh',
'ssl' or 'web'. 'webclient/websocket' or 'webclient/ajax'.
address (str): Client address. address (str): Client address.
sessionhandler (SessionHandler): Reference to the sessionhandler (SessionHandler): Reference to the
main sessionhandler instance. main sessionhandler instance.