mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-05-30 08:59:43 +00:00
feat(vp8channel): drain outbound channel before reconnect callback
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user