1
0
mirror of https://github.com/CPunch/Laika.git synced 2026-02-07 16:50:05 +00:00

Added laikaS_readENC laikaS_writeENC, minor refactoring

This commit is contained in:
2022-01-29 00:26:15 -06:00
parent 8627f5b85d
commit 56c6db1d62
8 changed files with 43 additions and 24 deletions

View File

@@ -58,9 +58,10 @@ bool laikaS_handlePeerIn(struct sLaika_peer *peer) {
if (recvd != sizeof(uint8_t) + sizeof(LAIKAPKT_SIZE))
LAIKA_ERROR("couldn't read whole LAIKAPKT_VARPKT_REQ")
/* read pktID */
peer->pktID = laikaS_readByte(&peer->sock);
/* sanity check packet ID, (check valid range, check it's variadic) */
/* sanity check pktID, (check valid range, check it's variadic) */
if (peer->pktID >= LAIKAPKT_MAXNONE || peer->pktSizeTable[peer->pktID])
LAIKA_ERROR("received evil pktID!\n")