1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-23 13:20:10 +00:00

minor refactoring, only call laikaT_getTime() once

This commit is contained in:
CPunch 2022-08-03 15:39:15 -05:00
parent 770e34463e
commit 3034c3bd8b

View File

@ -433,11 +433,10 @@ void laikaC_sweepPeersTask(struct sLaika_taskService *service, struct sLaika_tas
struct sLaika_peer *peer; struct sLaika_peer *peer;
struct sLaika_peerInfo *pInfo; struct sLaika_peerInfo *pInfo;
size_t i = 0; size_t i = 0;
long currTime; long currTime = laikaT_getTime();
while (laikaC_iterPeersNext(cnc, &i, &peer)) { while (laikaC_iterPeersNext(cnc, &i, &peer)) {
pInfo = GETPINFOFROMPEER(peer); pInfo = GETPINFOFROMPEER(peer);
currTime = laikaT_getTime();
/* peer has been silent for a while, kill 'em */ /* peer has been silent for a while, kill 'em */
if (currTime - pInfo->lastPing > LAIKA_PEER_TIMEOUT) { if (currTime - pInfo->lastPing > LAIKA_PEER_TIMEOUT) {