1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-24 05:31:03 +00:00

CNC: laikaC_sendPeerList() now uses laikaC_iterPeersNext()

This commit is contained in:
CPunch 2022-08-03 20:50:55 -05:00
parent 3034c3bd8b
commit dbbe5f5a2a

View File

@ -5,22 +5,18 @@
#include "lerror.h"
#include "lmem.h"
bool sendPanelPeerIter(struct sLaika_peer *peer, void *uData)
void laikaC_sendPeerList(struct sLaika_cnc *cnc, struct sLaika_peer *authPeer)
{
struct sLaika_peer *authPeer = (struct sLaika_peer *)uData;
struct sLaika_peer *peer;
size_t i = 0;
/* make sure we're not sending connection information to themselves */
/* send authPeer details on each peer that *isn't* itself */
while (laikaC_iterPeersNext(cnc, &i, &peer)) {
if (peer != authPeer) {
LAIKA_DEBUG("sending peer info %p to auth %p)\n", peer, authPeer);
laikaC_sendNewPeer(authPeer, peer);
}
return true;
}
void laikaC_sendPeerList(struct sLaika_cnc *cnc, struct sLaika_peer *authPeer)
{
laikaC_iterPeers(cnc, sendPanelPeerIter, (void *)authPeer);
}
void laikaC_sendNewPeer(struct sLaika_peer *authPeer, struct sLaika_peer *peer)