Permalink
Browse files

Hardent client code for multiple connections.

Signed-off-by: Jack Miller <jack@codezen.org>
  • Loading branch information...
1 parent 49aa0e7 commit 09b12b4b84ba2a34012d63aa0ddb06d943c2a82d @themoken committed May 13, 2012
Showing with 5 additions and 7 deletions.
  1. +5 −6 canto_next/client.py
  2. +0 −1 canto_next/protocol.py
View
@@ -28,8 +28,7 @@ def __init__(self, socket_name, **kwargs):
def connect(self):
CantoSocket.connect(self)
- self.conn = self.sockets[0]
- call_hook("new_socket", [self.conn])
+ call_hook("new_socket", [self.sockets[-1]])
# Sets self.conf_dir and self.socket_path
@@ -112,9 +111,9 @@ def start_daemon(self):
return pid
# Write a (cmd, args)
- def write(self, cmd, args):
- return self.do_write(self.conn, cmd, args)
+ def write(self, cmd, args, conn=0):
+ return self.do_write(self.sockets[conn], cmd, args)
# Read a (cmd, args)
- def read(self, timeout=None):
- return self.do_read(self.conn, timeout)
+ def read(self, timeout=None, conn=0):
+ return self.do_read(self.sockets[conn], timeout)
View
@@ -59,7 +59,6 @@ def __init__(self, socket_name, **kwargs):
# Server setup, potentially both unix and inet sockets.
def connect(self):
- self.sockets = []
if self.server:
if self.socket_name:
# Remove old unix socket.

0 comments on commit 09b12b4

Please sign in to comment.