[ENet-discuss] Issue with ENet which leads to crash.
heekz.shadow at yahoo.com
Sat Sep 17 07:24:31 PDT 2016
Greetings everyone. I am trying to implement multiplayer functionality into a game that only supports single-player. For this I have chosen to use ENet as the UDP networking library. So far so good, I can connect the client to the server, can connect multiple clients, etc. The sync system is like this: The server asks the nearest player to some entities to send information about those. This is done via an unreliable packet which contains two integers, the packet identifier number (so both client and server know what the packet means) and the information, which is the ID of the entity that needs to be synced. The client then replies with an unreliable packet which contains information about the entity (it's position, rotation, velocity, etc.). The server receives the packet, analyzes it and broadcasts it to the other players.
The issue that I am running into is when the server requests the players to give information about the given entities. This is done in a never-ending loop with a sleep of 1 ms in a separate thread. As soon as the last entity is iterated in the loop and the player is requested to send information about his nearest entity (for streaming purposes), the server crashes. If I try sending the requests as reliable packets, once the last packet is supposedly sent, the ENet server stops processing anything, from connections to simple ping requests.
Here is some debugging info for those who are more experienced in the issue. Feel free to contact me for any other information on this topic.
Picture of the crash location in protocol.c: https://i.gyazo.com/153760a3edab1a34d2530e296af22830.pngSequence of pictures from the first function called to the function which crashes the server:
This is the way I send the requests:https://i.gyazo.com/f45f12629be16b720b7a85eafbe25ca8.png
And this is the function which sends the packets:https://i.gyazo.com/15374562e81692c8ee331251e9fc2569.png
Any help would be kindly appreciated. :)Best regards.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ENet-discuss