From 1130561aa6092404f6f08735d3de8c22f120dee9 Mon Sep 17 00:00:00 2001 From: Philippe Crama Date: Tue, 28 Dec 2010 14:04:34 +0100 Subject: Check that connection is still valid before sending/retrying Since another thread might close the socket, make sure after the lock is acquired that the connection is still valid. Add global declaration for completeness --- skype/skyped.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/skype/skyped.py b/skype/skyped.py index 8115de55..247316f2 100644 --- a/skype/skyped.py +++ b/skype/skyped.py @@ -101,12 +101,13 @@ def skype_idle_handler(skype): return True def send(sock, txt): + global options count = 1 done = False - while (not done) and (count < 10): + while (not done) and (count < 10) and options.conn: if wait_for_lock(options.lock, 3, 10, "socket send"): try: - sock.send(txt) + if options.conn: sock.send(txt) options.lock.release() done = True except Exception, s: -- cgit v1.2.3