Skip to content

Commit

Permalink
Update the Queue usage in _AdbPacketStore
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Jul 3, 2021
1 parent 30b5aa6 commit 103f420
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions adb_shell/hidden_helpers.py
Expand Up @@ -53,9 +53,12 @@
import struct

try:
from queue import Queue
from asyncio import Queue
except ImportError: # pragma: no cover
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue

from . import constants

Expand Down Expand Up @@ -395,7 +398,7 @@ def get(self, arg0, arg1):
arg0, arg1 = self.find(arg0, arg1)

# Get the data from the queue
cmd, data = self._dict[arg1][arg0].get()
cmd, data = self._dict[arg1][arg0].get_nowait()

# If this is a `CLSE` packet, then clear the entry in the store
if cmd == constants.CLSE:
Expand Down Expand Up @@ -435,4 +438,4 @@ def put(self, arg0, arg1, cmd, data):
self._dict[arg1] = {arg0: Queue()}

# Put the data into the queue
self._dict[arg1][arg0].put((cmd, data))
self._dict[arg1][arg0].put_nowait((cmd, data))

0 comments on commit 103f420

Please sign in to comment.