handle dht is_closing

This commit is contained in:
Jack Robison 2019-04-10 10:26:16 -04:00
parent 63bf084a6a
commit 33a68b5cef
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -544,7 +544,7 @@ class KademliaProtocol(DatagramProtocol):
async def _send(self, peer: 'KademliaPeer', message: typing.Union[RequestDatagram, ResponseDatagram, async def _send(self, peer: 'KademliaPeer', message: typing.Union[RequestDatagram, ResponseDatagram,
ErrorDatagram]): ErrorDatagram]):
if not self.transport: if not self.transport or self.transport.is_closing():
raise TransportNotConnected() raise TransportNotConnected()
data = message.bencode() data = message.bencode()