From 38263c3d95b992be7e9fd6a266b0fd69aead7002 Mon Sep 17 00:00:00 2001 From: Cameron Patrick Date: Sat, 31 Jul 2004 10:38:07 +0000 Subject: [PATCH] keep going when the connection to the vending machine is lost --- sql-edition/servers/VendServer.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index a2cdfba..ff17122 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -400,6 +400,11 @@ if __name__ == '__main__': ServiceName = cp.get('VendingMachine', 'ServiceName') ServicePassword = cp.get('VendingMachine', 'Password') - - rfh, wfh = connect_to_vend(options, DBServer, DBName, DBUser, DBPassword, ServiceName, ServicePassword) - run_forever(rfh, wfh) + + while True: + rfh, wfh = connect_to_vend(options, DBServer, DBName, DBUser, DBPassword, ServiceName, ServicePassword) + try: + run_forever(rfh, wfh) + except VendingException: + print "Connection died, trying again..." + -- 2.20.1