summaryrefslogtreecommitdiffstats
path: root/module/remote/thriftbackend
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-02-29 17:46:51 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-02-29 17:46:51 +0100
commit33a7987d96f1d1da6cfef2aba0c3d6a12ce1bb57 (patch)
treedbacbc13772631abe6747f443362c74614be916a /module/remote/thriftbackend
parentlittle account, hoster fix (diff)
downloadpyload-33a7987d96f1d1da6cfef2aba0c3d6a12ce1bb57.tar.xz
ssl fix
Diffstat (limited to 'module/remote/thriftbackend')
-rw-r--r--module/remote/thriftbackend/Socket.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/module/remote/thriftbackend/Socket.py b/module/remote/thriftbackend/Socket.py
index 2243f9df2..c38c39198 100644
--- a/module/remote/thriftbackend/Socket.py
+++ b/module/remote/thriftbackend/Socket.py
@@ -8,7 +8,9 @@ from time import sleep
from thrift.transport.TSocket import TSocket, TServerSocket, TTransportException
-WantReadError = Exception #overwritten when ssl is used
+#overwritten when ssl is used
+WantReadError = None
+WantWriteError = None
class SecureSocketConnection:
def __init__(self, connection):
@@ -30,14 +32,14 @@ class SecureSocketConnection:
def send(self, buff):
try:
return self.__dict__["connection"].send(buff)
- except WantReadError:
+ except (WantReadError, WantWriteError):
sleep(0.1)
return self.send(buff)
def recv(self, buff):
try:
return self.__dict__["connection"].recv(buff)
- except WantReadError:
+ except (WantReadError, WantWriteError):
sleep(0.1)
return self.recv(buff)
@@ -47,9 +49,13 @@ class Socket(TSocket):
self.ssl = ssl
def open(self):
+ global WantReadError, WantWriteError
+
if self.ssl:
SSL = __import__("OpenSSL", globals(), locals(), "SSL", -1).SSL
WantReadError = SSL.WantReadError
+ WantWriteError = SSL.WantWriteError
+
ctx = SSL.Context(SSL.SSLv23_METHOD)
c = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM))
c.set_connect_state()