Open pfirsich opened 6 years ago
Looking at this a long time after, I notice I did some other dumb stuff in my fork by accident, because I have forgotten this PR. Obviously it should only be this commit: https://github.com/leafo/lua-enet/pull/19/commits/67f30730efd882d013ed4786e3f9970a4f66b06c I'm not interested in cleaning that up, but noticed it just now.
If the peer being sent to is not in the "connected" state, enet_peer_send will return -1 and the packet created by read_packet will not be freed.
I stumbled into this bug while I (foolishly) wrote this loop:
In that way I find the documentation on host:get_peer a little bit confusing: "Returns the connected peer at the specified index", because get_peer may very well return non-"connected" peers. Should the documentation be adjusted as well in that regard?