ryu/base/app_manager: introduce RyuApp:replay_to_request()

This is a handy method for event request/reply.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Isaku Yamahata 2013-04-04 12:28:04 +09:00 committed by FUJITA Tomonori
parent d763da58bc
commit 48b2665795

View File

@ -123,6 +123,13 @@ class RyuApp(object):
for observer in self.get_observers(ev, state): for observer in self.get_observers(ev, state):
self.send_event(observer, ev) self.send_event(observer, ev)
def reply_to_request(self, req, rep):
rep.dst = req.src
if req.sync:
self.send_reply(rep)
else:
self.send_event(rep.dst, rep)
def close(self): def close(self):
""" """
teardown method. teardown method.