This commit is contained in:
Marcel Battista
2021-03-01 01:07:31 +00:00
parent 9c3d441d16
commit 6e2b5084e7
2 changed files with 7 additions and 4 deletions

View File

@ -28,7 +28,7 @@ func (peer *Peer) WriteData(v interface{}) error {
}
func (peer *Peer) Destroy() error {
if peer.connection != nil && peer.connection.ConnectionState() == webrtc.PeerConnectionStateConnected {
if peer.connection != nil && peer.connection.ConnectionState() != webrtc.PeerConnectionStateClosed {
if err := peer.connection.Close(); err != nil {
return err
}