Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handle disconnection

On disconnection, raise an explicit VoldemortException. That may be easier for
clients to handle recovery/reconnection rather than checking for the
struct.error raised by unpack.
  • Loading branch information...
commit 581d97a475e3015f8784901665d8a16a92390565 1 parent e6abad1
@glinmac glinmac authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 clients/python/voldemort/client.py
View
4 clients/python/voldemort/client.py
@@ -239,6 +239,9 @@ def _send_request(self, connection, req_bytes):
## read a response from the connection
def _receive_response(self, connection):
size_bytes = connection.recv(4)
+ if not size_bytes:
+ raise VoldemortException('Connection closed')
+
size = struct.unpack('>i', size_bytes)[0]
bytes_read = 0
@@ -252,6 +255,7 @@ def _receive_response(self, connection):
return ''.join(data)
+
## Bootstrap cluster metadata from a list of urls of nodes in the cluster.
## The urls are tuples in the form (host, port).
## A dictionary of node_id => node is returned.
Please sign in to comment.
Something went wrong with that request. Please try again.