send_stats_request never catches hub.Timeout exception because it
has been caught by the event wait function itself.

Signed-off-by: Wei-Li Tang <[email protected]>
---
 ryu/lib/ofctl_v1_0.py | 5 ++---
 ryu/lib/ofctl_v1_2.py | 5 ++---
 ryu/lib/ofctl_v1_3.py | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/ryu/lib/ofctl_v1_0.py b/ryu/lib/ofctl_v1_0.py
index 96f2836..015f36a 100644
--- a/ryu/lib/ofctl_v1_0.py
+++ b/ryu/lib/ofctl_v1_0.py
@@ -201,9 +201,8 @@ def send_stats_request(dp, stats, waiters, msgs):
     waiters_per_dp[stats.xid] = (lock, msgs)
     dp.send_msg(stats)
 
-    try:
-        lock.wait(timeout=DEFAULT_TIMEOUT)
-    except hub.Timeout:
+    lock.wait(timeout=DEFAULT_TIMEOUT)
+    if not lock.is_set():
         del waiters_per_dp[stats.xid]
 
 
diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
index 8ca798a..48d5997 100644
--- a/ryu/lib/ofctl_v1_2.py
+++ b/ryu/lib/ofctl_v1_2.py
@@ -543,9 +543,8 @@ def send_stats_request(dp, stats, waiters, msgs):
     waiters_per_dp[stats.xid] = (lock, msgs)
     dp.send_msg(stats)
 
-    try:
-        lock.wait(timeout=DEFAULT_TIMEOUT)
-    except hub.Timeout:
+    lock.wait(timeout=DEFAULT_TIMEOUT)
+    if not lock.is_set():
         del waiters_per_dp[stats.xid]
 
 
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py
index 83bfce9..b7a69ee 100644
--- a/ryu/lib/ofctl_v1_3.py
+++ b/ryu/lib/ofctl_v1_3.py
@@ -571,9 +571,8 @@ def send_stats_request(dp, stats, waiters, msgs):
     waiters_per_dp[stats.xid] = (lock, msgs)
     dp.send_msg(stats)
 
-    try:
-        lock.wait(timeout=DEFAULT_TIMEOUT)
-    except hub.Timeout:
+    lock.wait(timeout=DEFAULT_TIMEOUT)
+    if not lock.is_set():
         del waiters_per_dp[stats.xid]
 
 
-- 
1.9.1


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to