Make new protobuf value consistent

This commit is contained in:
Jonathan Bennett
2026-04-14 18:47:53 -05:00
parent 87d0850f95
commit dc3947117e
2 changed files with 11 additions and 4 deletions
+2 -2
View File
@@ -556,7 +556,7 @@ def send_ack_frame(transport, state: SessionState, replay_from: Optional[int] =
state,
state.pb2.mesh.RemoteShell.ACK,
seq=0,
last_rx_seq=0 if replay_from is None else replay_from,
last_rx_seq=0 if replay_from is None else replay_from - 1,
remember=False,
)
@@ -675,7 +675,7 @@ def reader_loop(transport, state: SessionState) -> None:
#state.prune_sent_frames(shell.ack_seq)
if shell.op == state.pb2.mesh.RemoteShell.ACK:
#state.event_queue.put("peer requested replay")
replay_from = shell.last_rx_seq if shell.last_rx_seq > 0 else None
replay_from = shell.last_rx_seq + 1 if shell.last_rx_seq > 0 else None
if replay_from is not None:
#state.event_queue.put(f"peer requested replay from seq={replay_from}")
replay_frames_from(transport, state, replay_from)
+9 -2
View File
@@ -52,7 +52,7 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
if (frame.op == meshtastic_RemoteShell_OpCode_ACK) {
if (session.active && frame.session_id == session.sessionId && getFrom(&mp) == session.peer && frame.last_rx_seq > 0) {
resendFramesFrom(frame.last_rx_seq);
resendFramesFrom(frame.last_rx_seq + 1);
}
return ProcessMessage::CONTINUE;
}
@@ -77,6 +77,13 @@ ProcessMessage DMShellModule::handleReceived(const meshtastic_MeshPacket &mp)
}
if (!session.active || frame.session_id != session.sessionId || getFrom(&mp) != session.peer) {
if (!session.active) {
LOG_WARN("DMShell: no active session, rejecting op %d from 0x%x", frame.op, mp.from);
} else {
LOG_WARN("DMShell: session ID mismatch (got 0x%x expected 0x%x) or peer mismatch (got 0x%x expected 0x%x), rejecting "
"op %d",
frame.session_id, session.sessionId, mp.from, session.peer, frame.op);
}
sendError("invalid_session", getFrom(&mp));
return ProcessMessage::STOP;
}
@@ -501,7 +508,7 @@ void DMShellModule::sendAck(uint32_t replayFromSeq)
.cols = 0,
.rows = 0,
.flags = 0,
.last_rx_seq = replayFromSeq,
.last_rx_seq = replayFromSeq - 1,
};
frame.payload.size = 0;
sendFrameToPeer(session.peer, frame, false);