From ddbc951719d0798a96355931cf5077b6de8d94aa Mon Sep 17 00:00:00 2001 From: Cameron Patrick Date: Sun, 1 Aug 2004 05:22:03 +0000 Subject: [PATCH] can't readline from a socket --- sql-edition/servers/LATClient.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sql-edition/servers/LATClient.py b/sql-edition/servers/LATClient.py index b7818de..2603ce9 100644 --- a/sql-edition/servers/LATClient.py +++ b/sql-edition/servers/LATClient.py @@ -46,9 +46,12 @@ class LATClient: if ord(cmd) == LATCP_CMD_ERRORMSG: raise LATClientException(msg) - r = select([self.sock], [], [], 2.0)[0] + self.rfh = self.sock.makefile('r') + self.wfh = self.sock.makefile('w') + + r = select([self.rfh], [], [], 2.0)[0] if r: - l = self.sock.readline() + l = self.rfh.readline() if l.find('Service in use') >= 0: print "Service in use, apparently: restarting DEC server" self.reboot_server() @@ -75,8 +78,11 @@ class LATClient: mop.write(self.priv_password+'\n') mop.write('init del 0\n') mop.close() + print print "Waiting 10 seconds for DEC server to come back to life..." sleep(10) + print "Rightyo, back to vending!" + print def read_reply(self): head = self.sock.recv(3) @@ -91,4 +97,4 @@ class LATClient: return (cmd, msg) def get_fh(self): - return (self.sock.makefile('r'), self.sock.makefile('w')) + return (self.rfh, self.wfh) -- 2.20.1