Skip to content

Commit

Permalink
feat: add a timeout for handshake propose on server side
Browse files Browse the repository at this point in the history
Fixes #582
  • Loading branch information
agaffney committed Apr 10, 2024
1 parent c051f8e commit 85d6a5a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion protocol/handshake/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ func NewServer(protoOptions protocol.ProtocolOptions, cfg *Config) *Server {
Server: s,
ConnectionId: protoOptions.ConnectionId,
}
// Update state map with timeout
stateMap := StateMap.Copy()
if entry, ok := stateMap[statePropose]; ok {
entry.Timeout = s.config.Timeout
stateMap[statePropose] = entry
}
protoConfig := protocol.ProtocolConfig{
Name: ProtocolName,
ProtocolId: ProtocolId,
Expand All @@ -46,7 +52,7 @@ func NewServer(protoOptions protocol.ProtocolOptions, cfg *Config) *Server {
Role: protocol.ProtocolRoleServer,
MessageHandlerFunc: s.handleMessage,
MessageFromCborFunc: NewMsgFromCbor,
StateMap: StateMap,
StateMap: stateMap,
InitialState: statePropose,
}
s.Protocol = protocol.New(protoConfig)
Expand Down

0 comments on commit 85d6a5a

Please sign in to comment.