mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 18:46:11 +00:00
Do not track DTLS errors (client disconnect) on WebRTC close
This commit is contained in:
parent
0d7467048a
commit
652ffe37cc
2 changed files with 2 additions and 8 deletions
2
go.mod
2
go.mod
|
|
@ -10,7 +10,6 @@ require (
|
|||
github.com/gofrs/flock v0.8.1
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
github.com/kkyr/fig v0.3.1-0.20220103220255-711af35e3ee2
|
||||
github.com/pion/dtls/v2 v2.1.5
|
||||
github.com/pion/interceptor v0.1.12
|
||||
github.com/pion/logging v0.2.2
|
||||
github.com/pion/webrtc/v3 v3.1.51
|
||||
|
|
@ -28,6 +27,7 @@ require (
|
|||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pion/datachannel v1.5.5 // indirect
|
||||
github.com/pion/dtls/v2 v2.1.5 // indirect
|
||||
github.com/pion/ice/v2 v2.2.13 // indirect
|
||||
github.com/pion/mdns v0.0.5 // indirect
|
||||
github.com/pion/randutil v0.1.0 // indirect
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
package webrtc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/giongto35/cloud-game/v2/pkg/logger"
|
||||
"github.com/pion/dtls/v2"
|
||||
"github.com/pion/webrtc/v3"
|
||||
"github.com/pion/webrtc/v3/pkg/media"
|
||||
)
|
||||
|
|
@ -28,7 +26,6 @@ func New(log *logger.Logger, api *ApiFactory) *Peer { return &Peer{api: api, log
|
|||
|
||||
func (p *Peer) NewCall(vCodec, aCodec string, onICECandidate func(ice any)) (sdp any, err error) {
|
||||
if p.IsConnected() {
|
||||
p.log.Warn().Msg("Strange multiple init connection calls with the same peer")
|
||||
return
|
||||
}
|
||||
p.log.Info().Msg("WebRTC start")
|
||||
|
|
@ -170,11 +167,8 @@ func (p *Peer) Disconnect() {
|
|||
if p.conn == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if p.conn.ConnectionState() < webrtc.PeerConnectionStateDisconnected {
|
||||
if err := p.conn.Close(); err != nil && !errors.Is(err, dtls.ErrConnClosed) {
|
||||
p.log.Error().Err(err).Msg("WebRTC close")
|
||||
}
|
||||
_ = p.conn.Close()
|
||||
}
|
||||
p.conn = nil
|
||||
p.log.Debug().Msg("WebRTC stop")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue