Skip to content
Open
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
20 changes: 15 additions & 5 deletions peer/brontide.go
Original file line number Diff line number Diff line change
Expand Up @@ -1641,13 +1641,23 @@ func (p *Brontide) Disconnect(reason error) {
// started, otherwise we will skip reading it as this chan won't be
// closed, hence blocks forever.
if atomic.LoadInt32(&p.started) == 1 {
p.log.Debugf("Peer hasn't finished starting up yet, waiting " +
"on startReady signal before closing connection")

// First check if startup has already completed (non-blocking).
select {
case <-p.startReady:
case <-p.cg.Done():
return
// Startup already completed, no need to wait.

default:
// Still starting up, need to wait.
p.log.Debugf("Peer hasn't finished starting up yet, " +
"waiting on startReady signal before " +
"closing connection")

select {
case <-p.startReady:

case <-p.cg.Done():
return
}
}
}

Expand Down
Loading