mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-31 23:56:02 +10:00
Update byte skipping logic and improve clarity in MeshCoreConnector and ChannelMessage
This commit is contained in:
@@ -4323,7 +4323,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
routeType == _routeTransportFlood ||
|
routeType == _routeTransportFlood ||
|
||||||
routeType == _routeTransportDirect;
|
routeType == _routeTransportDirect;
|
||||||
if (hasTransport) {
|
if (hasTransport) {
|
||||||
reader.skipBytes(2); // Skip reserved bytes in transport header
|
// Skip reserved bytes in transport header made up of two u16 fields
|
||||||
|
reader.skipBytes(4);
|
||||||
}
|
}
|
||||||
final pathLenRaw = reader.readByte();
|
final pathLenRaw = reader.readByte();
|
||||||
final pathByteLen = _decodePathByteLen(pathLenRaw);
|
final pathByteLen = _decodePathByteLen(pathLenRaw);
|
||||||
|
|||||||
@@ -129,11 +129,11 @@ class ChannelMessage {
|
|||||||
if (code == respCodeChannelMsgRecvV3) {
|
if (code == respCodeChannelMsgRecvV3) {
|
||||||
reader.skipBytes(1); // Skip SNR
|
reader.skipBytes(1); // Skip SNR
|
||||||
final flags = reader.readByte();
|
final flags = reader.readByte();
|
||||||
|
final hasPath = (flags & 0x01) != 0;
|
||||||
reader.skipBytes(1); // Skip reserved byte
|
reader.skipBytes(1); // Skip reserved byte
|
||||||
channelIdx = reader.readByte();
|
channelIdx = reader.readByte();
|
||||||
pathLen = reader.readByte();
|
pathLen = reader.readByte();
|
||||||
txtType = reader.readByte();
|
txtType = reader.readByte();
|
||||||
final hasPath = (flags & 0x01) != 0;
|
|
||||||
if (hasPath && pathLen > 0) {
|
if (hasPath && pathLen > 0) {
|
||||||
reader.rewind(); // Rewind to read path length again for pathBytes
|
reader.rewind(); // Rewind to read path length again for pathBytes
|
||||||
pathBytes = reader.readBytes(pathLen);
|
pathBytes = reader.readBytes(pathLen);
|
||||||
|
|||||||
@@ -678,7 +678,7 @@ class MessageRetryService extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String? getContactKeyForAckHash(Uint8List ackHash) {
|
String? getContactKeyForAckHash(int ackHash) {
|
||||||
for (var entry in _pendingMessages.entries) {
|
for (var entry in _pendingMessages.entries) {
|
||||||
final message = entry.value;
|
final message = entry.value;
|
||||||
if (message.expectedAckHash != null &&
|
if (message.expectedAckHash != null &&
|
||||||
|
|||||||
Reference in New Issue
Block a user