diff options
author | 2015-04-18 14:08:18 +0200 | |
---|---|---|
committer | 2015-04-18 14:08:18 +0200 | |
commit | 6e8f84e1dc06cff6fa9387559992f555182c1774 (patch) | |
tree | 476600f9896fae029880e4049eb4c5e6021b202d /pyload/remote/thriftbackend/Socket.py | |
parent | fix: config cast (diff) | |
parent | Spare code cosmetics (5) (diff) | |
download | pyload-6e8f84e1dc06cff6fa9387559992f555182c1774.tar.xz |
Merge pull request #3 from vuolter/0.4.10
merge vuolter HEAD
Diffstat (limited to 'pyload/remote/thriftbackend/Socket.py')
-rw-r--r-- | pyload/remote/thriftbackend/Socket.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pyload/remote/thriftbackend/Socket.py b/pyload/remote/thriftbackend/Socket.py index 7d078ab93..3d2435a92 100644 --- a/pyload/remote/thriftbackend/Socket.py +++ b/pyload/remote/thriftbackend/Socket.py @@ -10,32 +10,33 @@ from thrift.transport.TSocket import TSocket, TServerSocket, TTransportException WantReadError = Exception #: overwritten when ssl is used + class SecureSocketConnection(object): def __init__(self, connection): - self.__dict__["connection"] = connection + self.__dict__['connection'] = connection def __getattr__(self, name): - return getattr(self.__dict__["connection"], name) + return getattr(self.__dict__['connection'], name) def __setattr__(self, name, value): - setattr(self.__dict__["connection"], name, value) + setattr(self.__dict__['connection'], name, value) def shutdown(self, how=1): - self.__dict__["connection"].shutdown() + self.__dict__['connection'].shutdown() def accept(self): - connection, address = self.__dict__["connection"].accept() + connection, address = self.__dict__['connection'].accept() return SecureSocketConnection(connection), address def send(self, buff): try: - return self.__dict__["connection"].send(buff) + return self.__dict__['connection'].send(buff) except WantReadError: sleep(0.1) return self.send(buff) @@ -43,11 +44,12 @@ class SecureSocketConnection(object): def recv(self, buff): try: - return self.__dict__["connection"].recv(buff) + return self.__dict__['connection'].recv(buff) except WantReadError: sleep(0.1) return self.recv(buff) + class Socket(TSocket): def __init__(self, host='localhost', port=7228, ssl=False): |