Commit 24207458 authored by Tristan Claverie's avatar Tristan Claverie
Browse files

Merge branch 'fix/5_ready_nil_response' into 'master'

[p] Fix crash if client disconnects before ready

Fix #5 

See merge request !60
parents e59a0da0 0a2cbcc0
Pipeline #732 passed with stages
......@@ -125,7 +125,7 @@ func (m *SignatureManager) promiseRound(pendingSet, sendSet []uint32, myID uint3
// Verifying we sent all the due promises
for range sendSet {
_ = <-c
......@@ -62,10 +62,10 @@ func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *contex
} // data == "" means the contractUUID is bad
return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_INVARG}}
case <-(*ctx).Done():
case <-(*ctx).Done(): // Client's disconnection
rooms.Unjoin(roomID, channel)
return nil
case <-time.After(10 * time.Minute):
return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_INVARG}}
case <-time.After(time.Minute): // Someone has not confirmed the signature within the delay
rooms.Unjoin(roomID, channel)
return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_TIMEOUT, Message: "timeout for ready signal"}}
Supports Markdown
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