mirror of
https://github.com/pion/webrtc.git
synced 2025-12-24 11:51:03 +08:00
Fix handling of Empty DataChannel messages
Requires: github.com/pion/datachannel v1.4.17
This commit is contained in:
committed by
Sean DuBois
parent
54315e0f7d
commit
80c9ef9a59
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user