race condition where the request is sent and connection lost right after

This commit is contained in:
Victor Shyba 2019-08-06 02:18:07 -03:00
parent e78e2738ef
commit 8fce374cae

View file

@ -473,6 +473,8 @@ class RPCSession(SessionBase):
async def send_request(self, method, args=()): async def send_request(self, method, args=()):
"""Send an RPC request over the network.""" """Send an RPC request over the network."""
if self.is_closing():
raise CancelledError()
message, event = self.connection.send_request(Request(method, args)) message, event = self.connection.send_request(Request(method, args))
await self._send_message(message) await self._send_message(message)
await event.wait() await event.wait()