clarify release of meshpacket back to pool

pull/18/head
Kevin Hester 2020-03-02 09:01:47 -08:00
rodzic 06449e39c1
commit 12a68026e7
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -190,16 +190,16 @@ public:
{ {
static FromRadio fRadio; static FromRadio fRadio;
// Encapsulate as a ToRadio packet // Encapsulate as a FromRadio packet
memset(&fRadio, 0, sizeof(fRadio)); memset(&fRadio, 0, sizeof(fRadio));
fRadio.which_variant = FromRadio_packet_tag; fRadio.which_variant = FromRadio_packet_tag;
fRadio.variant.packet = *mp; fRadio.variant.packet = *mp;
service.releaseToPool(mp); // we just copied the bytes, so don't need this buffer anymore
size_t numbytes = pb_encode_to_bytes(trBytes, sizeof(trBytes), FromRadio_fields, &fRadio); size_t numbytes = pb_encode_to_bytes(trBytes, sizeof(trBytes), FromRadio_fields, &fRadio);
DEBUG_MSG("delivering toPhone packet to phone %d bytes\n", numbytes); DEBUG_MSG("delivering toPhone packet to phone %d bytes\n", numbytes);
c->setValue(trBytes, numbytes); c->setValue(trBytes, numbytes);
service.releaseToPool(mp); // we just copied the bytes, so don't need this buffer anymore
} }
} }
}; };