Reopen closed fabric peer sessions

This commit is contained in:
2026-05-16 09:54:02 +03:00
parent 03efff6770
commit 057e3b65a7
4 changed files with 75 additions and 5 deletions
@@ -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{}