Commit 0a2cbcc0 authored by Loïck Bonniot's avatar Loïck Bonniot

[p] Fix crash if client disconnects before ready

parent e59a0da0
Pipeline #730 passed with stage
...@@ -125,7 +125,7 @@ func (m *SignatureManager) promiseRound(pendingSet, sendSet []uint32, myID uint3 ...@@ -125,7 +125,7 @@ func (m *SignatureManager) promiseRound(pendingSet, sendSet []uint32, myID uint3
// Verifying we sent all the due promises // Verifying we sent all the due promises
for range sendSet { for range sendSet {
_ = <-c <-c
} }
} }
......
...@@ -62,10 +62,10 @@ func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *contex ...@@ -62,10 +62,10 @@ func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *contex
} // data == "" means the contractUUID is bad } // data == "" means the contractUUID is bad
return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_INVARG}} return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_INVARG}}
} }
case <-(*ctx).Done(): case <-(*ctx).Done(): // Client's disconnection
rooms.Unjoin(roomID, channel) rooms.Unjoin(roomID, channel)
return nil return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_INVARG}}
case <-time.After(10 * time.Minute): case <-time.After(time.Minute): // Someone has not confirmed the signature within the delay
rooms.Unjoin(roomID, channel) rooms.Unjoin(roomID, channel)
return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_TIMEOUT, Message: "timeout for ready signal"}} return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_TIMEOUT, Message: "timeout for ready signal"}}
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment