def new_session(self, authkey):
if authkey in self.sessions:
raise Exception('INTERNAL ERROR: session already added for authkey')
sock, port = find_free_port()
session = Session(
port, authkey, self.address, sock, self.ws_cfg, self.home,
self.config['logging']
)
session.start() # new process!
self.join_later(session)
remote = RemoteSession((self.address[0], port), authkey)
# connect to the new session and add the connection to event tracking
try:
self.add_connection(remote.connect(5), authkey)
except Exception, e:
print('ERROR: could not connect to new session: %s' % str(e))
session.kill(signal.SIGKILL) # not much else to do
return
self.sessions[authkey] = (session, remote)
# override callback defined by Control class
评论列表
文章目录