Add overridable method self.configure_socket().

Allows for setting app specific socket timeouts and other socket options.
This commit is contained in:
Lance Stout 2011-08-25 00:22:26 -07:00
parent 82546d776d
commit 63b8444abe

View file

@ -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.