Alon Bar-Lev has uploaded a new change for review. Change subject: novnc: override get_target instead of new_client ......................................................................
novnc: override get_target instead of new_client seems to better follow the base class implementation, and does not duplicate communication logic into our code. Change-Id: I55d72f8f51d4502feec045138b31eaf69b46a323 Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M packaging/services/ovirt-websocket-proxy.py 1 file changed, 9 insertions(+), 22 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/84/15384/1 diff --git a/packaging/services/ovirt-websocket-proxy.py b/packaging/services/ovirt-websocket-proxy.py index e491f2c..d09ef04 100755 --- a/packaging/services/ovirt-websocket-proxy.py +++ b/packaging/services/ovirt-websocket-proxy.py @@ -18,7 +18,6 @@ import sys import signal import gettext -import socket import base64 import json import datetime @@ -45,29 +44,16 @@ self._ticketDecoder = kwargs.pop('ticketDecoder') super(OvirtWebSocketProxy, self).__init__(*args, **kwargs) - def new_client(self): + def get_target(self, target_cfg, path): """ - Called after a new WebSocket connection has been established. + Parses the path, extracts a token, and looks for a valid + target for that token in the configuration file(s). Sets + target_host and target_port if successful """ - connection_data = self._ticketDecoder.decode(self.path[1:]).split(':') + connection_data = self._ticketDecoder.decode(path[1:]).split(':') target_host = connection_data[0].encode('utf8') target_port = connection_data[1].encode('utf8') - - # Connect to the target - self.msg("connecting to: %s:%s" % ( - target_host, target_port)) - tsock = self.socket(target_host, target_port, - connect=True) - - # Start proxying - try: - self.do_proxy(tsock) - except: - if tsock: - tsock.shutdown(socket.SHUT_RDWR) - tsock.close() - self.vmsg("%s:%s: Target closed" % (target_host, target_port)) - raise + return (target_host, target_port) class TicketDecoder(object): @@ -192,8 +178,9 @@ else self._config.get('TRACE_FILE') ), web=None, - target_host='ignore', - target_port='ignore', + target_cfg='/dummy', + target_host=None, + target_port=None, wrap_mode='exit', wrap_cmd=None ).start_server() -- To view, visit http://gerrit.ovirt.org/15384 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I55d72f8f51d4502feec045138b31eaf69b46a323 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches