diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 061c295..3eb263a 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -342,7 +342,7 @@ class XMLStream(object): self.address = self.pick_dns_answer(self.default_domain, self.address[1]) self.socket = self.socket_class(Socket.AF_INET, Socket.SOCK_STREAM) - self.socket.settimeout(None) + self.configure_socket() if self.reconnect_delay is None: delay = 1.0 @@ -532,6 +532,14 @@ class XMLStream(object): if not ignore: self.state._set_state('connected') + def configure_socket(self): + """ + Set timeout and other options for self.socket. + + Meant to be overridden. + """ + self.socket.settimeout(None) + def start_tls(self): """ Perform handshakes for TLS.