summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Munda <sandro.munda@guardis.com>2012-11-01 11:36:52 +0100
committerSandro Munda <sandro.munda@guardis.com>2012-11-01 11:38:55 +0100
commit3a7569e3ea73b50823982fff6a5f2d73470e36b8 (patch)
tree42dbf1b2bce676ba067d1888238539da686fba33
parentd4449304940688b0fb6db09042ce4292cfc57859 (diff)
downloadslixmpp-3a7569e3ea73b50823982fff6a5f2d73470e36b8.tar.gz
slixmpp-3a7569e3ea73b50823982fff6a5f2d73470e36b8.tar.bz2
slixmpp-3a7569e3ea73b50823982fff6a5f2d73470e36b8.tar.xz
slixmpp-3a7569e3ea73b50823982fff6a5f2d73470e36b8.zip
Avoided to log a debug message error when the socket is normally closed.
-rw-r--r--sleekxmpp/plugins/xep_0065/proxy.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/sleekxmpp/plugins/xep_0065/proxy.py b/sleekxmpp/plugins/xep_0065/proxy.py
index b8e199ac..73c3c63d 100644
--- a/sleekxmpp/plugins/xep_0065/proxy.py
+++ b/sleekxmpp/plugins/xep_0065/proxy.py
@@ -2,6 +2,7 @@ import sys
import logging
import struct
import pickle
+import socket
from threading import Thread, Event
from hashlib import sha1
@@ -347,10 +348,14 @@ class Proxy(Thread):
# Wait any read available data on socket. Timeout
# after 5 secs.
ins, out, err = select([self.s, ], [], [], 5)
+ except socket.error as (errno, err):
+ # 9 means the socket is closed. It can be normal. Otherwise,
+ # log the error.
+ if errno != 9:
+ log.debug('Socket error: %s' % err)
+ break
except Exception as e:
- # There's an error with the socket (maybe the socket
- # has been closed and the file descriptor is bad).
- log.debug('Socket error: %s' % e)
+ log.debug(e)
break
for s in ins: