client closes peerconnection

This commit is contained in:
giongto35 2019-05-11 19:46:24 +08:00
parent 8c4f6f624e
commit 2a782100a0
4 changed files with 25 additions and 5 deletions

View file

@ -24,6 +24,7 @@ type Director struct {
const FPS = 60
func NewDirector(roomID string, imageChannel chan *image.RGBA, audioChannel chan float32, inputChannel chan int) *Director {
// return image channel from where it write
director := Director{}
director.Done = make(chan struct{})
director.audioChannel = audioChannel

View file

@ -130,6 +130,10 @@ func (view *GameView) Exit() {
if cartridge.Battery != 0 {
writeSRAM(sramPath(view.saveFile), cartridge.SRAM)
}
// close producer
close(view.imageChannel)
close(view.audioChannel)
}
// Update is called for every period of time, dt is the elapsed time from the last frame