diff options
| author | Philippe Crama <pcfeb0009@gmx.com> | 2010-12-28 14:04:34 +0100 | 
|---|---|---|
| committer | Philippe Crama <pcfeb0009@gmx.com> | 2010-12-28 14:04:34 +0100 | 
| commit | 1130561aa6092404f6f08735d3de8c22f120dee9 (patch) | |
| tree | 3f93d072a44891dd4d0e81166d95df0fe75a42b4 | |
| parent | d45adcf1981959f4200ec292d30f163e5b644893 (diff) | |
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
| -rw-r--r-- | skype/skyped.py | 5 | 
1 files 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: | 
