// detachPeerConn detaches a peerconnection from the current room.
detachPeerConn detaches a peerconnection from the current room.
// detachPeerConn detaches a peerconnection from the current room .
func (h *Handler) detachPeerConn(pc *webrtc.WebRTC) {
	log.Printf("[worker] closing peer connection")
	gameRoom := h.getRoom(pc.RoomID)
	if gameRoom == nil || gameRoom.IsEmpty() {
		return
	}
	gameRoom.RemoveSession(pc)
	if gameRoom.IsEmpty() {
		log.Printf("[worker] closing an empty room")
		gameRoom.Close()
		pc.InputChannel <- []byte{0xFF, 0xFF}
		close(pc.InputChannel)
	}
}
func ( h * Handler ) detachPeerConn ( pc * webrtc . WebRTC ) { log . Printf ( " " ) gameRoom := h . getRoom ( pc . RoomID ) if gameRoom == nil || gameRoom . IsEmpty ( ) { return } gameRoom . RemoveSession ( pc ) if gameRoom . IsEmpty ( ) { log . Printf ( " " ) gameRoom . Close ( ) pc . InputChannel <- [ ] byte { 0xFF , 0xFF } close ( pc . InputChannel ) } }
detachPeerConn detaches a peerconnection from the current room.
detachPeerConn detaches a peerconnection from the current room .