mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-01-25 02:21:45 +01:00
controller: fix send queue draining again
and this time add comments to explain the intention. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
9e6d3053c0
commit
fe6f94434c
@ -196,7 +196,16 @@ class Datapath(object):
|
||||
buf = self.send_q.get()
|
||||
self.socket.sendall(buf)
|
||||
finally:
|
||||
q = self.send_q
|
||||
# first, clear self.send_q to prevent new references.
|
||||
self.send_q = None
|
||||
# there might be threads currently blocking in send_q.put().
|
||||
# unblock them by draining the queue.
|
||||
try:
|
||||
while q.get(block=False):
|
||||
pass
|
||||
except hub.QueueEmpty:
|
||||
pass
|
||||
|
||||
def send(self, buf):
|
||||
if self.send_q:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user