can't readline from a socket
authorCameron Patrick <[email protected]>
Sun, 1 Aug 2004 05:22:03 +0000 (05:22 +0000)
committerCameron Patrick <[email protected]>
Sun, 1 Aug 2004 05:22:03 +0000 (05:22 +0000)
sql-edition/servers/LATClient.py

index b7818de..2603ce9 100644 (file)
@@ -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)

UCC git Repository :: git.ucc.asn.au