You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
derelict-enet is for enet 1.3.15. Stable upstream release is enet 1.3.17. Please update. :-)
Struct ENetPeer has a different length in 1.3.17 than the 1.3.15 D bindings (or 1.3.15 C headers) suggest. This risks array misindexing into the array of peers for every connected peer except peer 0.
Workaround
For usercode to run against enet 1.3.17 DLLs with the 1.3.15 bindings, usercode must guess the struct length of ENetPeer at runtime. When usercode receives a packet from a peer (who is not peer 0, who sits at the start of the array), look at the peer.incomingPeerID. If the bindings are correct, this works as an index into _host.peers. But even on mismatching bindings (wrong struct length), you can compute the DLL's struct length from that index with:
This workaround may be useful even with the most up-to-date bindings. When people build the usercode from source, they must install enet DLLs separately, and the usercode can only force a version of the bindings, not a version of the DLL. It can decide to abort on mismatching DLLs, or try this workaround.
The text was updated successfully, but these errors were encountered:
We're not maintaining Derelict anymore. It's been superseded by BindBC. I've not had a reason to port this one over yet, but I can make time for it this weekend.
derelict-enet is for enet 1.3.15. Stable upstream release is enet 1.3.17. Please update. :-)
Struct
ENetPeer
has a different length in 1.3.17 than the 1.3.15 D bindings (or 1.3.15 C headers) suggest. This risks array misindexing into the array of peers for every connected peer except peer 0.Workaround
For usercode to run against enet 1.3.17 DLLs with the 1.3.15 bindings, usercode must guess the struct length of
ENetPeer
at runtime. When usercode receives a packet from apeer
(who is not peer 0, who sits at the start of the array), look at thepeer.incomingPeerID
. If the bindings are correct, this works as an index into_host.peers
. But even on mismatching bindings (wrong struct length), you can compute the DLL's struct length from that index with:This workaround may be useful even with the most up-to-date bindings. When people build the usercode from source, they must install enet DLLs separately, and the usercode can only force a version of the bindings, not a version of the DLL. It can decide to abort on mismatching DLLs, or try this workaround.
The text was updated successfully, but these errors were encountered: