Hi,
Can not we apply in the following patch?
I have the following issue.
https://www.mail-archive.com/[email protected]/msg04532.html
The patch fixes the issue by giving an identifier to an event. Influence is
restrictive to component communication. And I am using the patch in my
environment now.
Thanks,
Satoshi
2013/10/25 Satoshi Kobayashi <[email protected]>
> The transaction id was assigned to processing.
>
> Signed-off-by: Satoshi Kobayashi <[email protected]>
> ---
> ryu/base/app_manager.py | 20 +++++++++++++++++---
> ryu/controller/event.py | 2 ++
> 2 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
> index b39d6cc..b771e29 100644
> --- a/ryu/base/app_manager.py
> +++ b/ryu/base/app_manager.py
> @@ -17,6 +17,7 @@
> import inspect
> import itertools
> import logging
> +import uuid
>
> from ryu import utils
> from ryu.controller.handler import register_instance
> @@ -61,7 +62,7 @@ class RyuApp(object):
> self.observers = {} # ev_cls -> observer-name -> states:set
> self.threads = []
> self.events = hub.Queue(128)
> - self.replies = hub.Queue()
> + self.replies = {}
> self.logger = logging.getLogger(self.name)
> self.threads.append(hub.spawn(self._event_loop))
>
> @@ -93,14 +94,25 @@ class RyuApp(object):
>
> def send_reply(self, rep):
> assert isinstance(rep, EventReplyBase)
> - SERVICE_BRICKS[rep.dst].replies.put(rep)
> + # take out the queue which puts reply
> + reply_q = SERVICE_BRICKS[rep.dst].replies[rep.xid]
> + # reply
> + reply_q.put(rep)
> + # delete the queue from the index of replies since the reply was
> sent
> + del SERVICE_BRICKS[rep.dst].replies[rep.xid]
>
> def send_request(self, req):
> assert isinstance(req, EventRequestBase)
> req.sync = True
> + # assign the transaction id for the request/reply
> + req.xid = uuid.uuid4()
> + # register the queue which receives the reply
> + reply_q = hub.Queue()
> + self.replies[req.xid] = reply_q
> + # request
> self.send_event(req.dst, req)
> # going to sleep for the reply
> - return self.replies.get()
> + return reply_q.get()
>
> def _event_loop(self):
> while True:
> @@ -129,6 +141,8 @@ class RyuApp(object):
>
> def reply_to_request(self, req, rep):
> rep.dst = req.src
> + # set the transaction id which becomes a pair
> + rep.xid = req.xid
> if req.sync:
> self.send_reply(rep)
> else:
> diff --git a/ryu/controller/event.py b/ryu/controller/event.py
> index 8191710..37f74c5 100644
> --- a/ryu/controller/event.py
> +++ b/ryu/controller/event.py
> @@ -23,6 +23,7 @@ class EventBase(object):
> class EventRequestBase(EventBase):
> def __init__(self):
> super(EventRequestBase, self).__init__()
> + self.xid = None
> self.dst = None # app.name of provide the event.
> self.src = None
> self.sync = False
> @@ -31,4 +32,5 @@ class EventRequestBase(EventBase):
> class EventReplyBase(EventBase):
> def __init__(self, dst):
> super(EventReplyBase, self).__init__()
> + self.xid = None
> self.dst = dst
> --
> 1.7.1
>
>
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel