Kaidrick / Project-Lava

An Java desktop application focusing on providing organized data access to DCS World net, export and mission environment runtime.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backend TCP connection and JSON messaging with DCS Lua

Kaidrick opened this issue · comments

Under some circumstances, a JSON string may be polluted some how by some random characters from another message, such as "[]" or be transmitted in a very broken state.

These messages may be lost, and the current implementation of the message handler throws an exception that will stop the polling handler.

The cause of such as problem may be that the message is too long, or the JSON parsing function was incorrectly interrupted by a backend disconnect of some sort.

The data itself should be intact, and therefore attempt should be made to re-transmit the message to backend in small chucks.

When a "baked" data is fetched from, say, Lua hook, it should not be immediately remove; a separate table should be used to store the message as in the form of lua table, and successfully processed message UUID should be transmitted to the Lua hook to delete the backup message from this separate table.

If process of the message failed (such as due to Gson's JsonSyntaxException), the backend should transmit a error message containing the UUID of the message to signal the message to be re-transmitted.