Reopen closed fabric peer sessions
This commit is contained in:
@@ -35,8 +35,12 @@ func (m *FabricSessionPeerManager) Get(ctx context.Context, target FabricSession
|
||||
}
|
||||
m.mu.Lock()
|
||||
if pump := m.sessions[key]; pump != nil {
|
||||
m.mu.Unlock()
|
||||
return pump, nil
|
||||
if pump.Closed() {
|
||||
delete(m.sessions, key)
|
||||
} else {
|
||||
m.mu.Unlock()
|
||||
return pump, nil
|
||||
}
|
||||
}
|
||||
m.mu.Unlock()
|
||||
|
||||
@@ -48,9 +52,13 @@ func (m *FabricSessionPeerManager) Get(ctx context.Context, target FabricSession
|
||||
|
||||
m.mu.Lock()
|
||||
if existing := m.sessions[key]; existing != nil {
|
||||
m.mu.Unlock()
|
||||
_ = pump.Close()
|
||||
return existing, nil
|
||||
if existing.Closed() {
|
||||
delete(m.sessions, key)
|
||||
} else {
|
||||
m.mu.Unlock()
|
||||
_ = pump.Close()
|
||||
return existing, nil
|
||||
}
|
||||
}
|
||||
if m.sessions == nil {
|
||||
m.sessions = map[string]*FabricSessionPump{}
|
||||
|
||||
Reference in New Issue
Block a user