mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 07:08:08 +00:00
Fix Socket
This commit is contained in:
@@ -97,7 +97,7 @@ class Font(Route):
|
||||
'(?:session/(?P<session>[^/]+))?/?'
|
||||
'(?:/wd/(?P<path>.+))?')
|
||||
class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
|
||||
session_history_size = 100000
|
||||
session_history_size = 10000
|
||||
# List of websockets per session
|
||||
sessions = {}
|
||||
|
||||
@@ -203,8 +203,11 @@ class TermWebSocket(Route, tornado.websocket.WebSocketHandler):
|
||||
TermWebSocket.sockets.remove(self)
|
||||
if self.session:
|
||||
TermWebSocket.sessions[self.session].remove(self)
|
||||
else:
|
||||
elif hasattr(self, '_terminal'):
|
||||
self._terminal.close()
|
||||
else:
|
||||
self.log.error(
|
||||
'Socket with neither session nor terminal %r' % self)
|
||||
if self.application.systemd and not len(TermWebSocket.terminals):
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@@ -73,13 +73,13 @@ class Terminal(object):
|
||||
"Can't switch to user %s" % self.user, exc_info=True)
|
||||
self.callee = None
|
||||
|
||||
# If no user where given and we are local, keep the same user
|
||||
# as the one who opened the socket
|
||||
# ie: the one openning a terminal in borwser
|
||||
# If no user where given and we are local, keep the same
|
||||
# user as the one who opened the socket ie: the one
|
||||
# openning a terminal in browser
|
||||
if not self.callee and not self.user and self.socket.local:
|
||||
self.callee = self.caller
|
||||
else:
|
||||
user = utils.parse_cert(self.stream.socket.getpeercert())
|
||||
user = utils.parse_cert(socket.getpeercert())
|
||||
assert user, 'No user in certificate'
|
||||
self.user = user
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user