summaryrefslogtreecommitdiff
path: root/bin/tiny_socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/tiny_socket.py')
-rw-r--r--bin/tiny_socket.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/tiny_socket.py b/bin/tiny_socket.py
index e7a9624c7fd..52690d09c1b 100644
--- a/bin/tiny_socket.py
+++ b/bin/tiny_socket.py
@@ -12,6 +12,9 @@ class mysocket:
self.sock.settimeout(60)
def connect(self, host, port):
self.sock.connect((host, port))
+ def disconnect(self):
+ self.sock.shutdown(socket.SHUT_RDWR)
+ self.sock.close()
def mysend(self, msg, exception=False):
msg = cPickle.dumps(msg)
size = len(msg)
@@ -36,4 +39,8 @@ class mysocket:
if chunk == '':
raise RuntimeError, "socket connection broken"
msg = msg + chunk
- return cPickle.loads(msg)
+ res = cPickle.loads(msg)
+ if isinstance(res,Exception):
+ raise res
+ else:
+ return res