Merge pull request #10826 from yznima/pr-race

Raft HTTP: fix pause/resume race condition
This commit is contained in:
Gyuho Lee 2019-06-17 09:58:18 -07:00 committed by GitHub
commit e5876c6ce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,12 +437,16 @@ type Pausable interface {
}
func (t *Transport) Pause() {
t.mu.RLock()
defer t.mu.RUnlock()
for _, p := range t.peers {
p.(Pausable).Pause()
}
}
func (t *Transport) Resume() {
t.mu.RLock()
defer t.mu.RUnlock()
for _, p := range t.peers {
p.(Pausable).Resume()
}