Skip to content

Commit

Permalink
Websockets: Stop iteration when connection closes.
Browse files Browse the repository at this point in the history
See issue aio-libs#1144.
  • Loading branch information
frederikaalund authored and Frederik Aalund committed Oct 19, 2016
1 parent 0033c48 commit 87fe03b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aiohttp/web_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,6 @@ def __aiter__(self):
@asyncio.coroutine
def __anext__(self):
msg = yield from self.receive()
if msg.type == WSMsgType.CLOSE:
if msg.type == WSMsgType.CLOSE or msg.type == WSMsgType.CLOSED:
raise StopAsyncIteration # NOQA
return msg

0 comments on commit 87fe03b

Please sign in to comment.