Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed May 8, 2019
1 parent 7a7c31e commit 7029f8c
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions mqttools/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,25 +700,16 @@ def __exit__(self, exc_type, exc_value, exc_traceback):
if self.packet_identifier in self._client.transactions:
del self._client.transactions[self.packet_identifier]

async def wait_for_response(self):
response = await self.wait_until_completed()
self._event.clear()

return response

async def wait_until_completed(self):
await asyncio.wait_for(self._event.wait(),
self._client.response_timeout)

return self._response

def set_response(self, response):
self._response = response
self._event.set()

def set_completed(self, response):
del self._client.transactions[self.packet_identifier]
self.set_response(response)
self._response = response
self._event.set()


class Client(object):
Expand Down

0 comments on commit 7029f8c

Please sign in to comment.