mirror of
https://github.com/CPunch/Laika.git
synced 2025-10-04 07:10:07 +00:00
Added LAIKAPKT_HANDSHAKE_REQ support to cnc.c
- minor refactoring - fixed CMakeLists.txt for cnc & bot
This commit is contained in:
@@ -5,7 +5,7 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
set(BOT_INCLUDEDIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
project(LaikaBot VERSION ${LAIKA_VERSION_MAJOR}.${LAIKA_VERSION_MINOR})
|
||||
project(LaikaBot VERSION 1.0)
|
||||
|
||||
# Put CMake targets (ALL_BUILD/ZERO_CHECK) into a folder
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
@@ -11,6 +11,8 @@ void laikaB_pktHandler(struct sLaika_peer *peer, uint8_t id, void *uData) {
|
||||
case LAIKAPKT_HANDSHAKE_RES: {
|
||||
uint8_t endianness = laikaS_readByte(&peer->sock);
|
||||
peer->sock.flipEndian = endianness != laikaS_isBigEndian();
|
||||
|
||||
LAIKA_DEBUG("handshake accepted by cnc!\n")
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -68,15 +70,15 @@ bool laikaB_poll(struct sLaika_bot *bot, int timeout) {
|
||||
|
||||
LAIKA_TRY
|
||||
if (evnt->pollIn && !laikaS_handlePeerIn(bot->peer))
|
||||
goto _BKill;
|
||||
goto _BOTKILL;
|
||||
|
||||
if (evnt->pollOut && !laikaS_handlePeerOut(bot->peer))
|
||||
goto _BKill;
|
||||
goto _BOTKILL;
|
||||
|
||||
if (!evnt->pollIn && !evnt->pollOut)
|
||||
goto _BKill;
|
||||
goto _BOTKILL;
|
||||
LAIKA_CATCH
|
||||
_BKill:
|
||||
_BOTKILL:
|
||||
laikaS_kill(&bot->peer->sock);
|
||||
LAIKA_TRYEND
|
||||
|
||||
|
Reference in New Issue
Block a user