fix data race in client crypto setup

This commit is contained in:
Marten Seemann
2017-05-06 23:44:15 +08:00
parent b3419633a6
commit 2014ced934

View File

@@ -323,6 +323,9 @@ func (h *cryptoSetupClient) GetSealer() (protocol.EncryptionLevel, Sealer) {
}
func (h *cryptoSetupClient) GetSealerWithEncryptionLevel(encLevel protocol.EncryptionLevel) (Sealer, error) {
h.mutex.RLock()
defer h.mutex.RUnlock()
switch encLevel {
case protocol.EncryptionUnencrypted:
return h.sealUnencrypted, nil