Fix handling of Empty DataChannel messages

Requires: github.com/pion/datachannel v1.4.17
This commit is contained in:
Norman Rasmussen
2020-05-11 01:05:29 -07:00
committed by Sean DuBois
parent 54315e0f7d
commit 80c9ef9a59
2 changed files with 2 additions and 10 deletions

View File

@@ -156,6 +156,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu
* [Chad Retz](https://github.com/cretz)
* [Simone Gotti](https://github.com/sgotti)
* [Cedric Fung](https://github.com/cedricfung)
* [Norman Rasmussen](https://github.com/normanr) - *Fix Empty DataChannel messages*
### License
MIT License - see [LICENSE](LICENSE) for full text

View File

@@ -335,10 +335,6 @@ func (d *DataChannel) Send(data []byte) error {
return err
}
if len(data) == 0 {
data = []byte{0}
}
_, err = d.dataChannel.WriteDataChannel(data, false)
return err
}
@@ -350,12 +346,7 @@ func (d *DataChannel) SendText(s string) error {
return err
}
data := []byte(s)
if len(data) == 0 {
data = []byte{0}
}
_, err = d.dataChannel.WriteDataChannel(data, true)
_, err = d.dataChannel.WriteDataChannel([]byte(s), true)
return err
}