diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2010-06-14 21:31:20 +0000 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2010-06-14 16:32:48 -0500 |
commit | 3b0da304269e30299784f5bd5e979a0673cb38fa (patch) | |
tree | 24fa6f88802846f8f46b740ba2713954c4d67ceb /src | |
parent | 2d430d7f599b36ab3f82937032891c32ef563f11 (diff) | |
download | bcfg2-3b0da304269e30299784f5bd5e979a0673cb38fa.tar.gz bcfg2-3b0da304269e30299784f5bd5e979a0673cb38fa.tar.bz2 bcfg2-3b0da304269e30299784f5bd5e979a0673cb38fa.zip |
Set a timeout on sockets accepted by the server
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5937 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/SSLServer.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/SSLServer.py b/src/lib/SSLServer.py index ca22a33b8..fe28203d3 100644 --- a/src/lib/SSLServer.py +++ b/src/lib/SSLServer.py @@ -100,6 +100,7 @@ class SSLServer (SocketServer.TCPServer, object): self.logger.error("Failed to bind to socket") raise + self.timeout = timeout self.socket.settimeout(timeout) self.keyfile = keyfile if keyfile != None: @@ -131,6 +132,7 @@ class SSLServer (SocketServer.TCPServer, object): def get_request(self): (sock, sockinfo) = self.socket.accept() + sock.settimeout(self.timeout) sslsock = ssl.wrap_socket(sock, server_side=True, certfile=self.certfile, keyfile=self.keyfile, cert_reqs=self.mode, ca_certs=self.ca, ssl_version=self.ssl_protocol) |