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 37a5a67391
commit e31b2a1ee4
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.
"""
self.protocol_key = "ssh"
self.authenticated_account = starttuple[0]
# obs must not be called self.factory, that gets overwritten!
self.cfactory = starttuple[1]

View file

@ -34,8 +34,8 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
"""
def __init__(self, *args, **kwargs):
self.protocol_name = "telnet"
super(TelnetProtocol, self).__init__(*args, **kwargs)
self.protocol_key = "telnet"
def connectionMade(self):
"""
@ -49,7 +49,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
# this number is counted down for every handshake that completes.
# when it reaches 0 the portal/server syncs their data
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
# the Server becomes aware of it.
self.sessionhandler.connect(self)

View file

@ -67,7 +67,7 @@ class SSLProtocol(TelnetProtocol):
def __init__(self, *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):

View file

@ -31,6 +31,9 @@ class WebSocketClient(Protocol, Session):
"""
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):
"""

View file

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

View file

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