Skip to content

Commit

Permalink
output a peer name to log message on ssl errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ei-grad committed Jul 9, 2012
1 parent 00688f9 commit e9acb43
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tornado/iostream.py
Expand Up @@ -650,7 +650,12 @@ def _do_ssl_handshake(self):
ssl.SSL_ERROR_ZERO_RETURN):
return self.close()
elif err.args[0] == ssl.SSL_ERROR_SSL:
logging.warning("SSL Error on %d: %s", self.socket.fileno(), err)
try:
peer = self.socket.getpeername()
except:
peer = 'not connected'
logging.warning("SSL Error on %d %s: %s",
self.socket.fileno(), peer, err)
return self.close()
raise
except socket.error, err:
Expand Down

0 comments on commit e9acb43

Please sign in to comment.