diff --git a/daemon/core/broker.py b/daemon/core/broker.py index b62536b8..5c6c6cb6 100644 --- a/daemon/core/broker.py +++ b/daemon/core/broker.py @@ -779,6 +779,14 @@ class CoreBroker(ConfigurableManager): self.session._handlerslock.release() return host + def handlerawmsg(self, msg): + ''' Helper to invoke handlemsg() using raw (packed) message bytes. + ''' + hdr = msg[:coreapi.CoreMessage.hdrsiz] + msgtype, flags, msglen = coreapi.CoreMessage.unpackhdr(hdr) + msgcls = coreapi.msg_class(msgtype) + return self.handlemsg(msgcls(flags, hdr, msg[coreapi.CoreMessage.hdrsiz:])) + def forwardmsg(self, msg, serverlist, handle_locally): ''' Forward API message to all servers in serverlist; if an empty host/port is encountered, set the handle_locally flag. Returns the diff --git a/daemon/core/session.py b/daemon/core/session.py index 32072682..f0608e45 100644 --- a/daemon/core/session.py +++ b/daemon/core/session.py @@ -246,10 +246,7 @@ class Session(object): except Exception, e: self.warn("Error sending Event Message: %s" % e) # also inform slave servers - coremsg = coreapi.CoreEventMessage(0, - msg[:coreapi.CoreMessage.hdrsiz], - msg[coreapi.CoreMessage.hdrsiz:]) - tmp = self.broker.handlemsg(coremsg) + tmp = self.broker.handlerawmsg(msg) return replies