mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
refactor: move media channel handling to common/ and setup duplex channel
a duplex media channel should be more realistic, you generally both send and receive media when doing video call and stuff
This commit is contained in:
parent
ff738ff045
commit
01bde142d4
5 changed files with 187 additions and 102 deletions
20
common/media/channel_test.go
Normal file
20
common/media/channel_test.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package media
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMediaChannelStop(t *testing.T) {
|
||||
mc := NewMediaChannel()
|
||||
|
||||
// This should not panic
|
||||
mc.Stop()
|
||||
|
||||
// Verify that the stop channel is closed
|
||||
select {
|
||||
case <-mc.stopCh:
|
||||
// Channel is closed, which is expected
|
||||
default:
|
||||
t.Fatal("MediaChannel stopCh should be closed after Stop()")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue