and this time add comments to explain the intention.
Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
ryu/controller/controller.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
index 4d0ccdf..7fe5ac9 100644
--- a/ryu/controller/controller.py
+++ b/ryu/controller/controller.py
@@ -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:
--
1.8.0.1
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel