@@ -68,7 +68,7 @@ void Dispatcher::loop() {
6868 next_tx_time = futureMillis (t * getAirtimeBudgetFactor ());
6969
7070 _radio->onSendFinished ();
71- logTx (outbound, 2 + outbound->path_len + outbound->payload_len );
71+ logTx (outbound, 2 + outbound->getPathByteLen () + outbound->payload_len );
7272 if (outbound->isRouteFlood ()) {
7373 n_sent_flood++;
7474 } else {
@@ -80,7 +80,7 @@ void Dispatcher::loop() {
8080 MESH_DEBUG_PRINTLN (" %s Dispatcher::loop(): WARNING: outbound packed send timed out!" , getLogDateTime ());
8181
8282 _radio->onSendFinished ();
83- logTxFail (outbound, 2 + outbound->path_len + outbound->payload_len );
83+ logTxFail (outbound, 2 + outbound->getPathByteLen () + outbound->payload_len );
8484
8585 releasePacket (outbound); // return to pool
8686 outbound = NULL ;
@@ -266,7 +266,7 @@ void Dispatcher::checkSend() {
266266 memcpy (&raw[len], &outbound->transport_codes [1 ], 2 ); len += 2 ;
267267 }
268268 raw[len++] = outbound->path_len ;
269- memcpy (&raw[len], outbound->path , outbound->path_len ); len += outbound-> path_len ;
269+ len += Packet::writePath (&raw[len], outbound->path , outbound->path_len );
270270
271271 if (len + outbound->payload_len > MAX_TRANS_UNIT) {
272272 MESH_DEBUG_PRINTLN (" %s Dispatcher::checkSend(): FATAL: Invalid packet queued... too long, len=%d" , getLogDateTime (), len + outbound->payload_len );
@@ -320,7 +320,7 @@ void Dispatcher::releasePacket(Packet* packet) {
320320}
321321
322322void Dispatcher::sendPacket (Packet* packet, uint8_t priority, uint32_t delay_millis) {
323- if (packet->path_len > MAX_PATH_SIZE || packet->payload_len > MAX_PACKET_PAYLOAD) {
323+ if (! Packet::isValidPathLen ( packet->path_len ) || packet->payload_len > MAX_PACKET_PAYLOAD) {
324324 MESH_DEBUG_PRINTLN (" %s Dispatcher::sendPacket(): ERROR: invalid packet... path_len=%d, payload_len=%d" , getLogDateTime (), (uint32_t ) packet->path_len , (uint32_t ) packet->payload_len );
325325 _mgr->free (packet);
326326 } else {
0 commit comments