def handle(self, connection_id, message_content): request = RegisterStateDeltaSubscriberRequest() request.ParseFromString(message_content) try: self._delta_processor.add_subscriber(connection_id, request.last_known_block_ids, request.address_prefixes) except NoKnownBlockError: LOGGER.debug('Subscriber %s added, but catch-up failed', connection_id) return HandlerResult(HandlerStatus.DROP) return HandlerResult(HandlerStatus.PASS)
def handle(self, connection_id, message_content): request = RegisterStateDeltaSubscriberRequest() request.ParseFromString(message_content) ack = RegisterStateDeltaSubscriberResponse() if self._delta_processor.is_valid_subscription( request.last_known_block_ids): ack.status = ack.OK return HandlerResult(HandlerStatus.RETURN_AND_PASS, message_out=ack, message_type=self._msg_type) else: ack.status = ack.UNKNOWN_BLOCK return HandlerResult(HandlerStatus.RETURN, message_out=ack, message_type=self._msg_type)
def handle(self, connection_id, message_content): request = RegisterStateDeltaSubscriberRequest() request.ParseFromString(message_content) ack = RegisterStateDeltaSubscriberResponse() try: self._delta_processor.add_subscriber(connection_id, request.last_known_block_ids, request.address_prefixes) ack.status = ack.OK except NoKnownBlockError: ack.status = ack.UNKNOWN_BLOCK return HandlerResult(HandlerStatus.RETURN, message_out=ack, message_type=self._msg_type)