get_extra_info fix
This commit is contained in:
parent
e261824593
commit
23b7ec3fb5
@ -760,9 +760,11 @@ class JSONSession(JSONSessionBase, asyncio.Protocol):
|
|||||||
|
|
||||||
def peer_info(self):
|
def peer_info(self):
|
||||||
'''Returns information about the peer.'''
|
'''Returns information about the peer.'''
|
||||||
if self.transport:
|
try:
|
||||||
|
# get_extra_info can throw even if self.transport is not None
|
||||||
return self.transport.get_extra_info('peername')
|
return self.transport.get_extra_info('peername')
|
||||||
return None
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
def abort(self):
|
def abort(self):
|
||||||
'''Cut the connection abruptly.'''
|
'''Cut the connection abruptly.'''
|
||||||
@ -776,7 +778,6 @@ class JSONSession(JSONSessionBase, asyncio.Protocol):
|
|||||||
|
|
||||||
def connection_lost(self, exc):
|
def connection_lost(self, exc):
|
||||||
'''Trigger timeouts of all pending requests.'''
|
'''Trigger timeouts of all pending requests.'''
|
||||||
self.transport = None
|
|
||||||
self.timeout_session()
|
self.timeout_session()
|
||||||
|
|
||||||
def is_closing(self):
|
def is_closing(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user