Parcourir la source

Hold a pending hybrid responder locked until it is filled in

JackDoan il y a 6 jours
Parent
commit
70e7d3f2ea
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      handshake_manager.go

+ 4 - 0
handshake_manager.go

@@ -802,6 +802,10 @@ func (hm *HandshakeManager) beginHandshake(via ViaSender, packet []byte, h *head
 			startTime: time.Now(),
 			responder: &hybridResponder{},
 		}
+		// The index is visible to msg3 as soon as it is allocated, so hold the
+		// entry until it is filled in.
+		pending.Lock()
+		defer pending.Unlock()
 		allocIndex = func() (uint32, error) { return hm.allocateIndex(pending) }
 	}