Skip to content

Commit

Permalink
added is_closed and is_open to input
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Childs committed Sep 26, 2016
1 parent 9d588de commit 238b180
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mimo/connection/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def push(self, item):

async def peek(self):
while self.empty():
if self._closed and len(self._putters) == 0:
if self.is_closed():
raise ConnectionClosed

getter = self._loop.create_future()
Expand Down Expand Up @@ -71,3 +71,9 @@ def close(self):
getter.set_exception(ConnectionClosed)
else:
getter.set_result(None)

def is_closed(self):
return self._closed and len(self._queue) == 0 and len(self._putters) == 0

def is_open(self):
return not self.is_closed()

0 comments on commit 238b180

Please sign in to comment.