kopia lustrzana https://github.com/meshtastic/firmware
clean up ack packets
rodzic
0307e4161e
commit
989f52494d
2
proto
2
proto
|
@ -1 +1 @@
|
|||
Subproject commit 6bb139c0a43825d868a5e78c07c443f8e9e80b55
|
||||
Subproject commit fa40a9389bc910b6291fabe148260070e393600f
|
|
@ -142,7 +142,7 @@ void DSRRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
|||
if (c) {
|
||||
// handle naks - convert them to route error packets
|
||||
// All naks are generated locally, because we failed resending the packet too many times
|
||||
PacketId nakId = c->fail_id;
|
||||
PacketId nakId = c->error_reason ? p->decoded.request_id : 0;
|
||||
if (nakId) {
|
||||
auto pending = findPendingPacket(p->to, nakId);
|
||||
if (pending &&
|
||||
|
|
|
@ -93,8 +93,10 @@ void MeshPlugin::sendResponse(const MeshPacket &req) {
|
|||
* This ensures that if the request packet was sent reliably, the reply is sent that way as well.
|
||||
*/
|
||||
void setReplyTo(MeshPacket *p, const MeshPacket &to) {
|
||||
assert(p->which_payloadVariant == MeshPacket_decoded_tag); // Should already be set by now
|
||||
p->to = to.from;
|
||||
p->want_ack = to.want_ack;
|
||||
p->decoded.request_id = to.id;
|
||||
}
|
||||
|
||||
std::vector<MeshPlugin *> MeshPlugin::GetMeshPluginsWithUIFrames() {
|
||||
|
|
|
@ -65,8 +65,8 @@ void ReliableRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
|||
|
||||
// If the payload is valid, look for ack/nak
|
||||
if (c) {
|
||||
PacketId ackId = c->success_id;
|
||||
PacketId nakId = c->fail_id;
|
||||
PacketId ackId = c->error_reason == Routing_Error_NONE ? p->decoded.request_id : 0;
|
||||
PacketId nakId = c->error_reason != 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) {
|
||||
|
|
|
@ -33,6 +33,7 @@ class SinglePortPlugin : public MeshPlugin
|
|||
// Update our local node info with our position (even if we don't decide to update anyone else)
|
||||
MeshPacket *p = router->allocForSending();
|
||||
p->decoded.portnum = ourPortNum;
|
||||
p->which_payloadVariant = MeshPacket_decoded_tag;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ extern const pb_msgdesc_t DeviceState_msg;
|
|||
#define DeviceState_fields &DeviceState_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
#define DeviceState_size 6146
|
||||
#define DeviceState_size 6156
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
@ -141,6 +141,7 @@ typedef struct _Data {
|
|||
bool want_response;
|
||||
uint32_t dest;
|
||||
uint32_t source;
|
||||
uint32_t request_id;
|
||||
} Data;
|
||||
|
||||
typedef struct _LogRecord {
|
||||
|
@ -282,10 +283,7 @@ typedef struct _Routing {
|
|||
RouteDiscovery route_request;
|
||||
RouteDiscovery route_reply;
|
||||
Routing_Error error_reason;
|
||||
uint32_t success_id;
|
||||
uint32_t fail_id;
|
||||
};
|
||||
uint32_t original_id;
|
||||
} Routing;
|
||||
|
||||
typedef struct _FromRadio {
|
||||
|
@ -366,8 +364,8 @@ extern "C" {
|
|||
#define Position_init_default {0, 0, 0, 0, 0}
|
||||
#define User_init_default {"", "", "", {0}}
|
||||
#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||
#define Routing_init_default {0, {RouteDiscovery_init_default}, 0}
|
||||
#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0}
|
||||
#define Routing_init_default {0, {RouteDiscovery_init_default}}
|
||||
#define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0}
|
||||
#define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN}
|
||||
#define ChannelSettings_init_default {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
|
||||
#define Channel_init_default {0, false, ChannelSettings_init_default, _Channel_Role_MIN}
|
||||
|
@ -381,8 +379,8 @@ extern "C" {
|
|||
#define Position_init_zero {0, 0, 0, 0, 0}
|
||||
#define User_init_zero {"", "", "", {0}}
|
||||
#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||
#define Routing_init_zero {0, {RouteDiscovery_init_zero}, 0}
|
||||
#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0}
|
||||
#define Routing_init_zero {0, {RouteDiscovery_init_zero}}
|
||||
#define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0}
|
||||
#define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN}
|
||||
#define ChannelSettings_init_zero {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0}
|
||||
#define Channel_init_zero {0, false, ChannelSettings_init_zero, _Channel_Role_MIN}
|
||||
|
@ -411,6 +409,7 @@ extern "C" {
|
|||
#define Data_want_response_tag 3
|
||||
#define Data_dest_tag 4
|
||||
#define Data_source_tag 5
|
||||
#define Data_request_id_tag 6
|
||||
#define LogRecord_message_tag 1
|
||||
#define LogRecord_time_tag 2
|
||||
#define LogRecord_source_tag 3
|
||||
|
@ -507,9 +506,6 @@ extern "C" {
|
|||
#define Routing_route_request_tag 1
|
||||
#define Routing_route_reply_tag 2
|
||||
#define Routing_error_reason_tag 3
|
||||
#define Routing_success_id_tag 4
|
||||
#define Routing_fail_id_tag 5
|
||||
#define Routing_original_id_tag 6
|
||||
#define FromRadio_num_tag 1
|
||||
#define FromRadio_my_info_tag 3
|
||||
#define FromRadio_node_info_tag 4
|
||||
|
@ -548,10 +544,7 @@ X(a, STATIC, REPEATED, FIXED32, route, 2)
|
|||
#define Routing_FIELDLIST(X, a) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (variant,route_request,route_request), 1) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (variant,route_reply,route_reply), 2) \
|
||||
X(a, STATIC, ONEOF, UENUM, (variant,error_reason,error_reason), 3) \
|
||||
X(a, STATIC, ONEOF, FIXED32, (variant,success_id,success_id), 4) \
|
||||
X(a, STATIC, ONEOF, FIXED32, (variant,fail_id,fail_id), 5) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, original_id, 6)
|
||||
X(a, STATIC, ONEOF, UENUM, (variant,error_reason,error_reason), 3)
|
||||
#define Routing_CALLBACK NULL
|
||||
#define Routing_DEFAULT NULL
|
||||
#define Routing_variant_route_request_MSGTYPE RouteDiscovery
|
||||
|
@ -562,7 +555,8 @@ X(a, STATIC, SINGULAR, UENUM, portnum, 1) \
|
|||
X(a, STATIC, SINGULAR, BYTES, payload, 2) \
|
||||
X(a, STATIC, SINGULAR, BOOL, want_response, 3) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, dest, 4) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, source, 5)
|
||||
X(a, STATIC, SINGULAR, FIXED32, source, 5) \
|
||||
X(a, STATIC, SINGULAR, FIXED32, request_id, 6)
|
||||
#define Data_CALLBACK NULL
|
||||
#define Data_DEFAULT NULL
|
||||
|
||||
|
@ -760,9 +754,9 @@ extern const pb_msgdesc_t ToRadio_msg;
|
|||
#define Position_size 37
|
||||
#define User_size 72
|
||||
#define RouteDiscovery_size 40
|
||||
#define Routing_size 47
|
||||
#define Data_size 255
|
||||
#define MeshPacket_size 294
|
||||
#define Routing_size 42
|
||||
#define Data_size 260
|
||||
#define MeshPacket_size 298
|
||||
#define ChannelSettings_size 87
|
||||
#define Channel_size 94
|
||||
#define RadioConfig_size 335
|
||||
|
@ -771,7 +765,7 @@ extern const pb_msgdesc_t ToRadio_msg;
|
|||
#define MyNodeInfo_size 89
|
||||
#define LogRecord_size 81
|
||||
#define FromRadio_size 344
|
||||
#define ToRadio_size 297
|
||||
#define ToRadio_size 301
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
@ -38,20 +38,14 @@ void RoutingPlugin::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom)
|
|||
{
|
||||
Routing c = Routing_init_default;
|
||||
|
||||
if (!err) {
|
||||
c.success_id = idFrom;
|
||||
} else {
|
||||
c.fail_id = idFrom;
|
||||
|
||||
// Also send back the error reason
|
||||
c.error_reason = err;
|
||||
}
|
||||
c.error_reason = err;
|
||||
|
||||
auto p = allocDataProtobuf(c);
|
||||
p->priority = MeshPacket_Priority_ACK;
|
||||
|
||||
p->hop_limit = 0; // Assume just immediate neighbors for now
|
||||
p->to = to;
|
||||
p->decoded.request_id = idFrom;
|
||||
DEBUG_MSG("Sending an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id);
|
||||
|
||||
router->sendLocal(p); // we sometimes send directly to the local node
|
||||
|
|
Ładowanie…
Reference in New Issue