handle -1 to be specific and != 0 for catch all just in case

This commit is contained in:
Jesse Horne 2022-10-17 22:06:52 -04:00
parent 597244d7f6
commit 1058882792

View file

@ -54,8 +54,10 @@ func (host *enetHost) Connect(addr Address, channelCount int, data uint32) (Peer
func (host *enetHost) CompressWithRangeCoder() error {
status := C.enet_host_compress_with_range_coder(host.cHost)
if status != 0 {
if status == -1 {
return errors.New("couldn't set the packet compressor to default range coder because context is nil")
} else if status != 0 {
return errors.New("couldn't set the packet compressor to default range coder for unknown reason")
}
return nil