Skip to content

Check connection is open #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion aioamqp/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ async def _drain(self):
# drain() cannot be called concurrently by multiple coroutines:
# http://bugs.python.org/issue29930. Remove this lock when no
# version of Python where this bugs exists is supported anymore.
await self._stream_writer.drain()
if self._stream_writer:
await self._stream_writer.drain()
else:
raise exceptions.AmqpClosedConnection()

async def _write_frame(self, channel_id, request, drain=True):
amqp_frame.write(self._stream_writer, channel_id, request)
Expand Down