1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-12-16 04:20:06 +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

@@ -13,7 +13,7 @@ void shell_pingTask(struct sLaika_taskService *service, struct sLaika_task *task
laikaS_emptyOutPacket(client->peer, LAIKAPKT_PINGPONG);
}
/* ==============================================[[ PeerHashMap ]]=============================================== */
/* ======================================[[ PeerHashMap ]]====================================== */
typedef struct sShell_hashMapElem {
int id;
@@ -33,7 +33,7 @@ uint64_t shell_ElemHash(const void *item, uint64_t seed0, uint64_t seed1) {
return *(uint64_t*)(u->pub); /* hashes pub key (first 8 bytes) */
}
/* ============================================[[ Packet Handlers ]]============================================= */
/* ====================================[[ Packet Handlers ]]==================================== */
void shellC_handleHandshakeRes(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uData) {
uint8_t endianness = laikaS_readByte(&peer->sock);
@@ -138,7 +138,9 @@ void shellC_handleShellClose(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *u
shellC_closeShell(client);
}
/* ==============================================[[ Packet Table ]]============================================== */
/* =====================================[[ Packet Table ]]====================================== */
/* clang-format off */
struct sLaika_peerPacketInfo shellC_pktTbl[LAIKAPKT_MAXNONE] = {
LAIKA_CREATE_PACKET_INFO(LAIKAPKT_HANDSHAKE_RES,
@@ -171,6 +173,8 @@ struct sLaika_peerPacketInfo shellC_pktTbl[LAIKAPKT_MAXNONE] = {
true)
};
/* clang-format on */
/* socket event */
void shellC_onPollFail(struct sLaika_socket *sock, void *uData) {
struct sLaika_peer *peer = (struct sLaika_peer*)sock;
@@ -179,7 +183,7 @@ void shellC_onPollFail(struct sLaika_socket *sock, void *uData) {
laikaS_kill(&client->peer->sock);
}
/* ===============================================[[ Client API ]]=============================================== */
/* ======================================[[ Client API ]]======================================= */
void shellC_init(tShell_client *client) {
laikaP_initPList(&client->pList);

View File

@@ -15,7 +15,7 @@
jmp_buf cmdE_err;
/* ===========================================[[ Helper Functions ]]============================================= */
/* ===================================[[ Helper Functions ]]==================================== */
tShell_cmdDef *shellS_findCmd(char *cmd);
@@ -30,7 +30,7 @@ int shellS_readInt(char *str) {
return atoi(str);
}
/* ===========================================[[ Command Handlers ]]============================================= */
/* ===================================[[ Command Handlers ]]==================================== */
void helpCMD(tShell_client *client, int argc, char *argv[]);
@@ -110,7 +110,7 @@ void openShellCMD(tShell_client *client, int argc, char *argv[]) {
PRINTSUCC("Shell closed!\n");
}
/* =============================================[[ Command Table ]]============================================== */
/* =====================================[[ Command Table ]]===================================== */
#define CREATECMD(_cmd, _syntax, _help, _callback) ((tShell_cmdDef){.cmd = _cmd, .syntax = _syntax, .help = _help, .callback = _callback})