Revert "Add Routing_Error_NONE"

This reverts commit e1985fa0f9.
pull/4458/head
Jonathan Bennett 2024-08-13 09:15:20 -05:00
rodzic bcd77c4523
commit f3fa8daedf
5 zmienionych plików z 19 dodań i 20 usunięć

Wyświetl plik

@ -253,8 +253,7 @@ void MeshService::sendToMesh(meshtastic_MeshPacket *p, RxSource src, bool ccToPh
LOG_DEBUG("Can't send status to phone");
}
if ((res == ERRNO_OK || res == meshtastic_Routing_Error_NONE_PKI) &&
ccToPhone) { // Check if p is not released in case it couldn't be sent
if (res == ERRNO_OK && ccToPhone) { // Check if p is not released in case it couldn't be sent
sendToPhone(packetPool.allocCopy(*p));
}
}

Wyświetl plik

@ -15,7 +15,7 @@ typedef uint32_t PacketId; // A packet sequence number
#define ERRNO_OK 0
#define ERRNO_NO_INTERFACES 33
#define ERRNO_UNKNOWN 32 // pick something that doesn't conflict with RH_ROUTER_ERROR_UNABLE_TO_DELIVER
#define ERRNO_DISABLED 35 // the interface is disabled
#define ERRNO_DISABLED 34 // the interface is disabled
/*
* Source of a received message

Wyświetl plik

@ -117,17 +117,20 @@ void ReliableRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
}
// We consider an ack to be either a !routing packet with a request ID or a routing packet with !error
if ((c && (c->error_reason == meshtastic_Routing_Error_NONE || c->error_reason == meshtastic_Routing_Error_NONE_PKI)) ||
!c) {
LOG_DEBUG("Received an ack for 0x%x, stopping retransmissions\n", p->decoded.request_id);
stopRetransmission(p->to, p->decoded.request_id);
// } else if (c && (c->error_reason == meshtastic_Routing_Error_NO_CHANNEL)) {
// noop?
} else if (c &&
(c->error_reason != meshtastic_Routing_Error_NONE && c->error_reason != meshtastic_Routing_Error_NONE_PKI)) {
PacketId ackId = ((c && c->error_reason == meshtastic_Routing_Error_NONE) || !c) ? p->decoded.request_id : 0;
LOG_DEBUG("Received a nak for 0x%x, stopping retransmissions\n", p->decoded.request_id);
stopRetransmission(p->to, p->decoded.request_id);
// A nak is a routing packt that has an error code
PacketId nakId = (c && c->error_reason != meshtastic_Routing_Error_NONE) ? p->decoded.request_id : 0;
// We intentionally don't check wasSeenRecently, because it is harmless to delete non existent retransmission records
if (ackId || nakId) {
if (ackId) {
LOG_DEBUG("Received an ack for 0x%x, stopping retransmissions\n", ackId);
stopRetransmission(p->to, ackId);
} else {
LOG_DEBUG("Received a nak for 0x%x, stopping retransmissions\n", nakId);
stopRetransmission(p->to, nakId);
}
}
}

Wyświetl plik

@ -258,7 +258,7 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
meshtastic_MeshPacket *p_decoded = packetPool.allocCopy(*p);
auto encodeResult = perhapsEncode(p);
if (encodeResult != meshtastic_Routing_Error_NONE && encodeResult != meshtastic_Routing_Error_NONE_PKI) {
if (encodeResult != meshtastic_Routing_Error_NONE) {
packetPool.release(p_decoded);
abortSendAndNak(encodeResult, p);
return encodeResult; // FIXME - this isn't a valid ErrorCode
@ -493,10 +493,8 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
p->encrypted.size = numbytes;
p->which_payload_variant = meshtastic_MeshPacket_encrypted_tag;
}
if (p->pki_encrypted)
return meshtastic_Routing_Error_NONE_PKI;
else
return meshtastic_Routing_Error_NONE;
return meshtastic_Routing_Error_NONE;
}
NodeNum Router::getNodeNum()

Wyświetl plik

@ -1105,8 +1105,7 @@ ProcessMessage CannedMessageModule::handleReceived(const meshtastic_MeshPacket &
this->incoming = service->getNodenumFromRequestId(mp.decoded.request_id);
meshtastic_Routing decoded = meshtastic_Routing_init_default;
pb_decode_from_bytes(mp.decoded.payload.bytes, mp.decoded.payload.size, meshtastic_Routing_fields, &decoded);
this->ack = decoded.error_reason == meshtastic_Routing_Error_NONE ||
decoded.error_reason == meshtastic_Routing_Error_NONE_PKI;
this->ack = decoded.error_reason == meshtastic_Routing_Error_NONE;
waitingForAck = false; // No longer want routing packets
this->notifyObservers(&e);
// run the next time 2 seconds later