ofctl_v1_0: fix stats timeout handling

This patch fixes a issue reported by https://github.com/osrg/ryu/issues/7

Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
OHMURA Kei 2013-01-24 10:56:19 +09:00 committed by FUJITA Tomonori
parent 63c8a15e7c
commit abd1039801

View File

@ -172,15 +172,15 @@ def match_to_str(m):
def send_stats_request(dp, stats, waiters, msgs):
dp.set_xid(stats)
waiters = waiters.setdefault(dp.id, {})
waiters_per_dp = waiters.setdefault(dp.id, {})
lock = gevent.event.AsyncResult()
waiters[stats.xid] = (lock, msgs)
waiters_per_dp[stats.xid] = (lock, msgs)
dp.send_msg(stats)
try:
lock.get(timeout=DEFAULT_TIMEOUT)
except gevent.Timeout:
del waiters[dp.id][stats.xid]
del waiters_per_dp[stats.xid]
def get_desc_stats(dp, waiters):