Skip to content

Commit

Permalink
retry 4 times if an error happens in the main loop
Browse files Browse the repository at this point in the history
  • Loading branch information
poliva committed Apr 29, 2016
1 parent 9befd57 commit 2dfc66b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ggpofba.py
Expand Up @@ -300,6 +300,7 @@ def udp_proxy(args,q):
sockfd.setblocking(0)

logging.info("setting nonblocking sockets")
failed=0

while True:
try:
Expand All @@ -313,11 +314,15 @@ def udp_proxy(args,q):
if peerdata:
l_sockfd.sendto( peerdata, emuaddr )
except Exception, e:
logging.info("exit loop")
failed+=1
logging.info("ERROR: %s" % (repr(e)))
sockfd.close()
l_sockfd.close()
os._exit(0)
if (failed < 4):
pass
else:
logging.info("exit loop")
sockfd.close()
l_sockfd.close()
os._exit(0)

def killGgpoFbaNG():
if platform.system()=="Windows":
Expand Down

0 comments on commit 2dfc66b

Please sign in to comment.