def handle(self, connection_id, message_content):
        request = PeerUnregisterRequest()
        request.ParseFromString(message_content)
        LOGGER.debug("got peer unregister message "
                     "from %s. sending ack", connection_id)
        self._gossip.unregister_peer(connection_id)
        ack = NetworkAcknowledgement()
        ack.status = ack.OK

        return HandlerResult(HandlerStatus.RETURN,
                             message_out=ack,
                             message_type=validator_pb2.Message.NETWORK_ACK)
예제 #2
0
    def handle(self, identity, message_content):
        request = PeerUnregisterRequest()
        request.ParseFromString(message_content)
        LOGGER.debug("got peer unregister message "
                     "from %s. sending ack", identity)

        ack = NetworkAcknowledgement()
        ack.status = ack.OK

        return HandlerResult(HandlerStatus.RETURN,
                             message_out=ack,
                             message_type=validator_pb2.Message.GOSSIP_ACK)
예제 #3
0
    def handle(self, message, peer):
        request = PeerUnregisterRequest()
        request.ParseFromString(message.content)

        self._service.unregister_peer(message.sender, request.identity)

        LOGGER.debug("Got peer unregister message "
                     "from %s. Sending ack", message.sender)

        ack = NetworkAcknowledgement()
        ack.status = ack.OK

        peer.send(
            validator_pb2.Message(sender=message.sender,
                                  message_type='gossip/ack',
                                  correlation_id=message.correlation_id,
                                  content=ack.SerializeToString()))