Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Raft HTTP: fix pause/resume race condition #4

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rafthttp/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,16 @@ type Pausable interface {
}

func (t *Transport) Pause() {
t.mu.RLock()
defer t.mu.RUnlock()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add locking and unlocking to Start() as well?

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()
}
Expand Down