Skip to content

Commit 70f0cf6

Browse files
Copilotpetesramek
andcommitted
Changes before error encountered
Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com> Agent-Logs-Url: https://github.com/petesramek/tiny-link/sessions/1ac8a035-8aaf-4224-ad0a-f2deb1f5eeec
1 parent bbd972c commit 70f0cf6

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/TinyLink.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,20 @@ namespace tinylink {
156156
return true;
157157
}
158158

159+
// ---- State utility --------------------------------------------------
160+
//
161+
// Returns priorState unchanged for connection-phase states
162+
// (AWAITING_ACK, CONNECTING), otherwise returns WAIT_FOR_SYNC.
163+
// Used whenever a non-data event must not disturb an in-progress
164+
// connection or ACK wait.
165+
//
166+
TinyState restoreState(TinyState priorState) const {
167+
return (priorState == TinyState::AWAITING_ACK ||
168+
priorState == TinyState::CONNECTING)
169+
? priorState
170+
: TinyState::WAIT_FOR_SYNC;
171+
}
172+
159173
// ---- Handshake handler (symmetric two-frame exchange) ---------------
160174
//
161175
// The HandshakeMessage::version byte distinguishes the two frame kinds:

0 commit comments

Comments
 (0)