diff options
author | Takeshi <a86487817@gmail.com> | 2015-08-05 23:45:00 +0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-10 11:24:05 +0900 |
commit | 79db6268067eb35c138f05b0c9e5039a04b943f5 (patch) | |
tree | 2b7cf03274e551a2daf5a834948f3822c5cd56c1 | |
parent | 3706eec9bc1e6585912339efc0f6be3c2817c903 (diff) |
use idle timeout in ofctl to avoid incomplete querying
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/ofctl_v1_0.py | 8 | ||||
-rw-r--r-- | ryu/lib/ofctl_v1_2.py | 8 | ||||
-rw-r--r-- | ryu/lib/ofctl_v1_3.py | 8 |
3 files changed, 24 insertions, 0 deletions
diff --git a/ryu/lib/ofctl_v1_0.py b/ryu/lib/ofctl_v1_0.py index 04b9b7da..939207bc 100644 --- a/ryu/lib/ofctl_v1_0.py +++ b/ryu/lib/ofctl_v1_0.py @@ -274,10 +274,18 @@ def send_stats_request(dp, stats, waiters, msgs): dp.set_xid(stats) waiters_per_dp = waiters.setdefault(dp.id, {}) lock = hub.Event() + previous_msg_len = len(msgs) waiters_per_dp[stats.xid] = (lock, msgs) dp.send_msg(stats) lock.wait(timeout=DEFAULT_TIMEOUT) + current_msg_len = len(msgs) + + while current_msg_len > previous_msg_len: + previous_msg_len = current_msg_len + lock.wait(timeout=DEFAULT_TIMEOUT) + current_msg_len = len(msgs) + 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 37f87924..038bb494 100644 --- a/ryu/lib/ofctl_v1_2.py +++ b/ryu/lib/ofctl_v1_2.py @@ -382,10 +382,18 @@ def send_stats_request(dp, stats, waiters, msgs): dp.set_xid(stats) waiters_per_dp = waiters.setdefault(dp.id, {}) lock = hub.Event() + previous_msg_len = len(msgs) waiters_per_dp[stats.xid] = (lock, msgs) dp.send_msg(stats) lock.wait(timeout=DEFAULT_TIMEOUT) + current_msg_len = len(msgs) + + while current_msg_len > previous_msg_len: + previous_msg_len = current_msg_len + lock.wait(timeout=DEFAULT_TIMEOUT) + current_msg_len = len(msgs) + 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 84902069..5b709f3a 100644 --- a/ryu/lib/ofctl_v1_3.py +++ b/ryu/lib/ofctl_v1_3.py @@ -404,10 +404,18 @@ def send_stats_request(dp, stats, waiters, msgs): dp.set_xid(stats) waiters_per_dp = waiters.setdefault(dp.id, {}) lock = hub.Event() + previous_msg_len = len(msgs) waiters_per_dp[stats.xid] = (lock, msgs) dp.send_msg(stats) lock.wait(timeout=DEFAULT_TIMEOUT) + current_msg_len = len(msgs) + + while current_msg_len > previous_msg_len: + previous_msg_len = current_msg_len + lock.wait(timeout=DEFAULT_TIMEOUT) + current_msg_len = len(msgs) + if not lock.is_set(): del waiters_per_dp[stats.xid] |