def handle_datagram_reciever(self, datagram): di = PyDatagramIterator(datagram) reciever_channel = di.getUint64() sender_channel = di.getUint64() msg_type = di.getUint16() if msg_type == STATESERVER_OBJECT_GENERATE_WITH_REQUIRED: location = (di.getUint32(), di.getUint32()) self.current_reciever = reciever_channel if location == (0, 0): print ("Tried to generate an object for an unknown location!") return self.do_interest_manager.handleGenerateWithRequired(self.current_reciever, location, di.getUint32()) if msg_type == STATESERVER_OBJECT_GENERATE_WITH_REQUIRED_OTHER: doId = di.getUint32() location = (di.getUint32(), di.getUint32()) self.current_reciever = reciever_channel if location == (0, 0): print ("Tried to generate an object for an unknown location!") return self.do_interest_manager.handleGenerateWithRequiredAndId(self.current_reciever, doId, location, di.getUint32()) else: print ("Stateserver: Recieved a message that's unknown to the protocol, from %s" % str(sender_channel)) # debug error return
def handle_datagram_reciever(self, datagram): di = PyDatagramIterator(datagram) reciever_channel = di.getUint64() sender_channel = di.getUint64() msg_type = di.getUint16() if msg_type == STATESERVER_OBJECT_GENERATE_WITH_REQUIRED: location = (di.getUint32(), di.getUint32()) self.current_reciever = reciever_channel if location == (0, 0): print("Tried to generate an object for an unknown location!") return self.do_interest_manager.handleGenerateWithRequired( self.current_reciever, location, di.getUint32()) if msg_type == STATESERVER_OBJECT_GENERATE_WITH_REQUIRED_OTHER: doId = di.getUint32() location = (di.getUint32(), di.getUint32()) self.current_reciever = reciever_channel if location == (0, 0): print("Tried to generate an object for an unknown location!") return self.do_interest_manager.handleGenerateWithRequiredAndId( self.current_reciever, doId, location, di.getUint32()) else: print( "Stateserver: Recieved a message that's unknown to the protocol, from %s" % str(sender_channel)) # debug error return
def handle_datagram_reciever(self, datagram): connection = datagram.getConnection() if not connection: print ("Got an unexpected connection: %s" % str(connection)) return di = PyDatagramIterator(datagram) reciever_channel = di.getUint64() sender_channel = di.getUint64() msg_type = di.getUint16() print msg_type
def handle_datagram_reciever(self, datagram): connection = datagram.getConnection() if not connection: print("Got an unexpected connection: %s" % str(connection)) return di = PyDatagramIterator(datagram) reciever_channel = di.getUint64() sender_channel = di.getUint64() msg_type = di.getUint16() print msg_type
def handleDatagram(self, datagram): connection = datagram.getConnection() if not connection: return di = PyDatagramIterator(datagram) message_type = di.getUint16() if message_type == CONTROL_SET_CHANNEL: self.registerChannel(di.getUint64(), connection) elif message_type == CONTROL_REMOVE_CHANNEL: self.unregisterChannel(di.getUint64()) elif message_type == CONTROL_MESSAGE: self.routeMessage(di.getUint64(), di.getDatagram())
def handleDatagram(self, datagram): connection = datagram.getConnection() di = PyDatagramIterator(datagram) message_type = di.getUint16() if message_type == CLIENT_AGENT_SET_INTEREST: self.handleClientAgentSetInterest( di, sender=di.getUint64(), handle=di.getUint16(), contextId=di.getUint32(), parentId=di.getUint32(), zoneId=di.getUint32(), ) elif message_type == CLIENT_AGENT_REMOVE_INTEREST: self.handleRemoveInterest(di, sender=di.getUint64(), handle=di.getUint16(), contextId=di.getUint32())
def handle_packet(self, dg): dgi = PyDatagramIterator(dg) msg = dgi.getUint16() self.logger.debug("received message - %d" % msg) # begin handling messages here if msg == msg_types.CONTROL_SET_CHANNEL: channel = dgi.getUint64() connection = dg.getConnection() self.register_channel(channel, connection) elif msg == msg_types.CONTROL_REMOVE_CHANNEL: channel = dgi.getUint16() self.unregister_channel(channel) else: self.logger.warn("received unimplemented message type - %d" % msg)