summaryrefslogtreecommitdiffstats
path: root/module/remote
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-05-24 00:14:23 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-05-24 00:14:23 +0200
commitf1a20ba26fda68993325b16196f563e6aeebe60c (patch)
tree5e920ca5eacef7913b60e0d1cc289d87e9949a3b /module/remote
parentfixed bug in asynchandler (diff)
downloadpyload-f1a20ba26fda68993325b16196f563e6aeebe60c.tar.xz
improvements to json api
Diffstat (limited to 'module/remote')
-rw-r--r--module/remote/create_apitypes.py9
-rw-r--r--module/remote/wsbackend/Server.py13
2 files changed, 15 insertions, 7 deletions
diff --git a/module/remote/create_apitypes.py b/module/remote/create_apitypes.py
index 7755b5c57..d596f07ac 100644
--- a/module/remote/create_apitypes.py
+++ b/module/remote/create_apitypes.py
@@ -3,19 +3,18 @@
import re
import inspect
-import sys
from os.path import abspath, dirname, join
path = dirname(abspath(__file__))
-module = join(path, "..", "..")
-
-sys.path.append(join(module, "lib"))
-sys.path.append(join(module, "remote"))
+root = abspath(join(path, "..", ".."))
from thrift.Thrift import TType
from thriftgen.pyload import ttypes
from thriftgen.pyload import Pyload
+# TODO: import and add version
+# from pyload import CURRENT_VERSION
+
type_map = {
TType.BOOL: 'bool',
TType.DOUBLE: 'float',
diff --git a/module/remote/wsbackend/Server.py b/module/remote/wsbackend/Server.py
index 9b52f5464..af5e1cf19 100644
--- a/module/remote/wsbackend/Server.py
+++ b/module/remote/wsbackend/Server.py
@@ -459,9 +459,18 @@ class WebSocketRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler):
if self._options.is_executable_method is not None:
self.is_executable = self._options.is_executable_method
+ # OWN MODIFICATION
# This actually calls BaseRequestHandler.__init__.
- CGIHTTPServer.CGIHTTPRequestHandler.__init__(
- self, request, client_address, server)
+ try:
+ CGIHTTPServer.CGIHTTPRequestHandler.__init__(
+ self, request, client_address, server)
+ except socket.error, e:
+ # Broken pipe, let it pass
+ if e.errno != 32:
+ raise
+ self._logger.debug("WS: Broken pipe")
+
+
def parse_request(self):
"""Override BaseHTTPServer.BaseHTTPRequestHandler.parse_request.