mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-22 09:37:09 +00:00
add recover for inputchannel
This commit is contained in:
parent
1267869ab0
commit
4e2a43eba4
1 changed files with 6 additions and 4 deletions
|
|
@ -108,6 +108,12 @@ func (r *Room) AddConnectionToRoom(peerconnection *webrtc.WebRTC, playerIndex in
|
|||
}
|
||||
|
||||
func (r *Room) startWebRTCSession(peerconnection *webrtc.WebRTC, playerIndex int) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Println("Recovered when sent to close inputChannel")
|
||||
}
|
||||
}()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-r.Done:
|
||||
|
|
@ -140,10 +146,6 @@ func (r *Room) startWebRTCSession(peerconnection *webrtc.WebRTC, playerIndex int
|
|||
|
||||
func (r *Room) CleanSession(peerconnection *webrtc.WebRTC) {
|
||||
r.removeSession(peerconnection)
|
||||
// TODO: Clean all channels
|
||||
//close(peerconnection.ImageChannel)
|
||||
//close(peerconnection.AudioChannel)
|
||||
//close(peerconnection.InputChannel)
|
||||
}
|
||||
|
||||
func (r *Room) removeSession(w *webrtc.WebRTC) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue