From 63b8444abe94eb2a4bc3922510a89ef0a30a0008 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 25 Aug 2011 00:22:26 -0700 Subject: [PATCH] Add overridable method self.configure_socket(). Allows for setting app specific socket timeouts and other socket options. --- sleekxmpp/xmlstream/xmlstream.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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.