feat(vp8channel): drain outbound channel before reconnect callback

This commit is contained in:
zarazaex69
2026-04-30 14:13:54 +03:00
parent 4a5b255db6
commit 9a5a4b249d

View File

@@ -148,8 +148,23 @@ func (p *streamTransport) Close() error {
return nil
}
func (p *streamTransport) drainOutbound() {
for {
select {
case <-p.outbound:
default:
return
}
}
}
func (p *streamTransport) SetReconnectCallback(cb func()) {
p.stream.SetReconnectCallback(cb)
p.stream.SetReconnectCallback(func() {
p.drainOutbound()
if cb != nil {
cb()
}
})
}
func (p *streamTransport) SetShouldReconnect(fn func() bool) {