Skip to content

Commit

Permalink
Serialize CIDs in state
Browse files Browse the repository at this point in the history
Updates state serialization and deserialization to include connection
IDs if they were negotiated.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
  • Loading branch information
hasheddan committed Aug 28, 2023
1 parent 37fbc04 commit e142ee1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ type serializedState struct {
PeerCertificates [][]byte
IdentityHint []byte
SessionID []byte
LocalConnectionID []byte
RemoteConnectionID []byte
IsClient bool
}

Expand Down Expand Up @@ -105,6 +107,8 @@ func (s *State) serialize() *serializedState {
PeerCertificates: s.PeerCertificates,
IdentityHint: s.IdentityHint,
SessionID: s.SessionID,
LocalConnectionID: s.localConnectionID,
RemoteConnectionID: s.remoteConnectionID,
IsClient: s.isClient,
}
}
Expand Down Expand Up @@ -141,7 +145,13 @@ func (s *State) deserialize(serialized serializedState) {

// Set remote certificate
s.PeerCertificates = serialized.PeerCertificates

s.IdentityHint = serialized.IdentityHint

// Set local and remote connection IDs
s.localConnectionID = serialized.LocalConnectionID
s.remoteConnectionID = serialized.RemoteConnectionID

s.SessionID = serialized.SessionID
}

Expand Down

0 comments on commit e142ee1

Please sign in to comment.