Commit 905fc273 by Bach Dániel

fix exception handling

parent d6d1303e
...@@ -20,7 +20,7 @@ import optparse ...@@ -20,7 +20,7 @@ import optparse
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
PROXY_SECRET = environ.get('PROXY_SECRET') PROXY_SECRET = environ['PROXY_SECRET']
KEY_MAX_AGE = environ.get('KEY_MAX_AGE', 300) KEY_MAX_AGE = environ.get('KEY_MAX_AGE', 300)
...@@ -70,6 +70,11 @@ class ProxyClientFactory(protocol.ReconnectingClientFactory): ...@@ -70,6 +70,11 @@ class ProxyClientFactory(protocol.ReconnectingClientFactory):
self.cli_queue = cli_queue self.cli_queue = cli_queue
self.src = src self.src = src
def clientConnectionFailed(self, connector, reason):
self.srv_queue.put(False)
logger.error("Client(%s): unable to connect to qemu: %s",
self.src, reason)
class VNCWebSocketHandler(Protocol): class VNCWebSocketHandler(Protocol):
def makeConnection(self, transport): def makeConnection(self, transport):
...@@ -84,8 +89,9 @@ class VNCWebSocketHandler(Protocol): ...@@ -84,8 +89,9 @@ class VNCWebSocketHandler(Protocol):
port = value['port'] port = value['port']
host = value['host'] host = value['host']
except Exception as e: except Exception as e:
src = getattr(self, 'src', None)
logger.warning('Server(%s): bad connection, key=%s err=%s', logger.warning('Server(%s): bad connection, key=%s err=%s',
self.src, transport.request.args['d'][0], e) src, transport.request.args['d'][0], e)
transport.loseConnection() transport.loseConnection()
return return
logger.info("Server(%s): new connection, host=%s, port=%s", logger.info("Server(%s): new connection, host=%s, port=%s",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment