(Boeing r1764)
added Broker.handlerawmsg() helper to invoke handlemsg() using packed bytes
This commit is contained in:
parent
83d238c691
commit
30965ba950
2 changed files with 9 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue