1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-10-08 17:00:11 +00:00

Added LAIKAPKT_PINGPONG

- shell now has it's own task service, it's polled in shellC_poll()
- default timeout for peers is 60 seconds, to change this edit the LAIKA_PEER_TIMEOUT in cnc.h
This commit is contained in:
2022-04-13 12:19:06 -05:00
parent 89630b1a5e
commit 9694ae67d8
13 changed files with 100 additions and 7 deletions

View File

@@ -6,12 +6,17 @@
#include "lsocket.h"
#include "lpolllist.h"
#include "lpeer.h"
#include "ltask.h"
#include "hashmap.h"
/* kill peers if they haven't ping'd within a minute */
#define LAIKA_PEER_TIMEOUT 60 * 1000
typedef bool (*tLaika_peerIter)(struct sLaika_peer *peer, void *uData);
struct sLaika_peerInfo {
struct sLaika_cnc *cnc;
long lastPing;
};
#define BASE_PEERINFO struct sLaika_peerInfo info;
@@ -63,4 +68,9 @@ void laikaC_iterPeers(struct sLaika_cnc *cnc, tLaika_peerIter iter, void *uData)
struct sLaika_peer *laikaC_getPeerByPub(struct sLaika_cnc *cnc, uint8_t *pub);
/* kills peers who haven't ping'd in a while */
void laikaC_sweepPeersTask(struct sLaika_taskService *service, struct sLaika_task *task, clock_t currTick, void *uData);
void laikaC_iterPeers(struct sLaika_cnc *cnc, tLaika_peerIter iter, void *uData);
#endif