On Jun 4, 2014, at 12:56 AM, Peter Peresini <peter.peres...@epfl.ch> wrote:
> Hi Murphy, > here is another patch. This one fixes a bug where FeaturesReceived was > raised by connection itself but the event did not went through. (see lines > 245-246 of of_01.py). Thanks! Pushed. I had to rebase it and tweaked the commit message. > Actually, POX should log an error/warning if you try to raise an event which > is not published by your class. I do not have a patch for that but it looks > to me that the necessary changes are: > - in revent/revent.py, raiseEvent function, replace raise RuntimeError with > some new special error, call it EventNotFoundError() > - in revent/revent.py raiseEventNoError function should not ignore > EventNotFoundError but log an error in this case (and proceed silently > otherwise) I'd considered doing pretty much exactly this in the past but I guess I decided it wasn't worth it because it doesn't solve the issue for a common case. If the event isn't actually on the object, you can't bind a handler for it. If you try with addHandler() or addHandlerByName(), it's an error. But if you use addHandlers(), it simply doesn't get bound. If you use the raiseX(class, args...) form of event raising, the early-out in raiseEvent() returns before the check whether the event type is valid since there are no listeners bound. One could put the check earlier, but the early-out is done on purpose, and I don't think I'm willing to add another set membership check in the common case in order to "optimize" for the error case. (At least, not without profiling the change.) That said, this would catch some such errors, and doesn't hurt anything in the other case, so I've gone ahead and done it. -- Murphy > From af28225d5dbe25b443dd3f86bb23c7460846ad74 Mon Sep 17 00:00:00 2001 > From: Peter Peresini <peter.peres...@gmail.com> > Date: Wed, 4 Jun 2014 09:44:17 +0200 > Subject: [PATCH] Connection is raising FeaturesReceived event but it was not > in event mixin. > > --- > pox/openflow/of_01.py | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/pox/openflow/of_01.py b/pox/openflow/of_01.py > index e21663a..12a3a36 100644 > --- a/pox/openflow/of_01.py > +++ b/pox/openflow/of_01.py > @@ -691,6 +691,7 @@ class Connection (EventMixin): > PortStatsReceived, > QueueStatsReceived, > FlowRemoved, > + FeaturesReceived, > ]) > > # Globally unique identifier for the Connection instance > -- > 1.8.3.2