Skip to content

Commit

Permalink
goddamn fucking shit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Oberstein committed Sep 5, 2015
1 parent 307a0e8 commit 303d289
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion autobahn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
#
###############################################################################

__version__ = "0.10.6"
__version__ = "0.10.7"
version = __version__ # backward compat.
17 changes: 15 additions & 2 deletions autobahn/twisted/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,21 @@ def connectionLost(self, reason):
peer=self.peer)

elif isinstance(reason.value, ConnectionLost):
self.factory.log.debug("Connection to/from {peer} was lost in a non-clean fashion: {message}",
peer=self.peer, message=reason.value.args[0])
# The following is ridiculous, but the treatment of reason.value.args
# across py2/3 and tx and over various corner cases is deeply fucked up.
if hasattr(reason.value, 'message'):
message = reason.value.message
elif hasattr(reason.value, 'args') and type(reason.value.args) == tuple and len(reason.value.args) > 0:
message = reason.value.args[0]
else:
message = None

if message:
self.factory.log.debug("Connection to/from {peer} was lost in a non-clean fashion: {message}",
peer=self.peer, message=message)
else:
self.factory.log.debug("Connection to/from {peer} was lost in a non-clean fashion",
peer=self.peer)

# at least: FileDescriptorOverrun, ConnectionFdescWentAway - but maybe others as well?
else:
Expand Down

0 comments on commit 303d289

Please sign in to comment.