From 0a2f85026794b5b3b14da81387274e85b6247aa1 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Mon, 31 Jan 2011 10:34:42 -0600 Subject: [PATCH] Reap websockify zombies. Add IE9 fix for websock.js. Reap websockify zombies. Fixes: https://github.com/kanaka/noVNC/issues#issue/47. Thanks NeilW. Changes to get web-socket-js to work with IE9. Right now it's a hack to get around: https://github.com/gimite/web-socket-js/issues#issue/41. The hack is to disable caching of the flash objects by appending "?" + Math.random() to the end of the flash object path (but only when using IE). --- docs/TODO | 6 ++++++ include/websock.js | 6 +++++- websocket.py | 11 +++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/TODO b/docs/TODO index cdf0c41..a1dd86d 100644 --- a/docs/TODO +++ b/docs/TODO @@ -3,3 +3,9 @@ - create gevent version: http://nichol.as/benchmark-of-python-web-servers http://n01se.net/paste/QXO + + - Need at least libevent-1.4 (i.e. not 9.04 Jaunty) + + sudo aptitude install python-dev libevent-dev python-setuptools + + sudo easy_install gevent diff --git a/include/websock.js b/include/websock.js index b9f52d7..5caf3df 100644 --- a/include/websock.js +++ b/include/websock.js @@ -32,7 +32,11 @@ if (window.WebSocket) { end = "'><\/script>", extra = ""; WEB_SOCKET_SWF_LOCATION = get_INCLUDE_URI() + - "web-socket-js/WebSocketMain.swf"; + "web-socket-js/WebSocketMain.swf?" + Math.random(); + if (Util.Engine.trident) { + Util.Debug("Forcing uncached load of WebSocketMain.swf"); + WEB_SOCKET_SWF_LOCATION += "?" + Math.random(); + } extra += start + "web-socket-js/swfobject.js" + end; extra += start + "web-socket-js/FABridge.js" + end; extra += start + "web-socket-js/web_socket.js" + end; diff --git a/websocket.py b/websocket.py index aeb5063..cfda870 100755 --- a/websocket.py +++ b/websocket.py @@ -315,8 +315,15 @@ Connection: Upgrade\r #self.vmsg("Running poll()") pass + + def top_SIGCHLD(self, sig, stack): + # Reap zombies after calling child SIGCHLD handler + self.do_SIGCHLD(sig, stack) + self.vmsg("Got SIGCHLD, reaping zombies") + os.waitpid(-1, os.WNOHANG) + def do_SIGCHLD(self, sig, stack): - self.vmsg("Got SIGCHLD, ignoring") + pass def do_SIGINT(self, sig, stack): self.msg("Got SIGINT, exiting") @@ -345,7 +352,7 @@ Connection: Upgrade\r self.started() # Some things need to happen after daemonizing # Reep zombies - signal.signal(signal.SIGCHLD, self.do_SIGCHLD) + signal.signal(signal.SIGCHLD, self.top_SIGCHLD) signal.signal(signal.SIGINT, self.do_SIGINT) while True: