Skip to content

Commit

Permalink
work under py34
Browse files Browse the repository at this point in the history
  • Loading branch information
etataurov committed Feb 13, 2016
1 parent b26439d commit 05976de
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions asyncio_apns/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class ErrorWaiter:
def __init__(self, connection, *, loop=None):
self._connection = connection
self.waiters = OrderedDict()
self._loop = loop
self._loop = loop or asyncio.get_event_loop()
self._read_future = None

def start_waiting(self):
self._read_future = asyncio.ensure_future(self.read())
self._read_future = self._loop.create_task(self.read())

def stop(self):
if self._read_future:
Expand Down Expand Up @@ -77,8 +77,7 @@ def succeed(self, message_id):

def expect(self, message_id, timeout=5):
f = asyncio.Future(loop=self._loop)
loop = self._loop or asyncio.get_event_loop()
handle = loop.call_later(timeout, self.succeed, message_id)
handle = self._loop.call_later(timeout, self.succeed, message_id)
self.waiters[message_id] = (f, handle)
return f

Expand Down

0 comments on commit 05976de

Please sign in to comment.