Beispiel #1
0
/* the main loop that needs to be run at least 200 times per second. */
void doMessenger()
{
    IP_Port ip_port;
    uint8_t data[MAX_UDP_PACKET_SIZE];
    uint32_t length;
    while (receivepacket(&ip_port, data, &length) != -1) {
#ifdef DEBUG
        /* if(rand() % 3 != 1) //simulate packet loss */
        /* { */
        if (DHT_handlepacket(data, length, ip_port) && LosslessUDP_handlepacket(data, length, ip_port) &&
            friendreq_handlepacket(data, length, ip_port) && LANdiscovery_handlepacket(data, length, ip_port))
            /* if packet is discarded */
            printf("Received unhandled packet with length: %u\n", length);
        else
            printf("Received handled packet with length: %u\n", length);
        /* } */
        printf("Status: %u %u %u\n",friendlist[0].status ,is_cryptoconnected(friendlist[0].crypt_connection_id),  friendlist[0].crypt_connection_id);
#else
        DHT_handlepacket(data, length, ip_port);
        LosslessUDP_handlepacket(data, length, ip_port);
        friendreq_handlepacket(data, length, ip_port);
        LANdiscovery_handlepacket(data, length, ip_port);
#endif

    }
    doDHT();
    doLossless_UDP();
    doNetCrypto();
    doInbound();
    doFriends();
    LANdiscovery();
}
/* the main loop that needs to be run at least 20 times per second. */
void doMessenger(Messenger *m)
{
    networking_poll(m->net);

    do_DHT(m->dht);
    do_net_crypto(m->net_crypto);
    doInbound(m);
    doFriends(m);
    LANdiscovery(m);
}
/* the main loop that needs to be run at least 200 times per second. */
void doMessenger(void)
{
    networking_poll();
	
    doDHT();
    doLossless_UDP();
    doNetCrypto();
    doInbound();
    doFriends();
    LANdiscovery();
}
Beispiel #4
0
/* the main loop that needs to be run at least 200 times per second. */
void doMessenger(Messenger *m)
{
    networking_poll();

    doDHT();
    doLossless_UDP();
    doNetCrypto();
    doInbound(m);
    doFriends(m);

    timer_poll();
}
Beispiel #5
0
Datei: DHT.c Projekt: nypox/nctox
void doDHT()
{
    doClose();
    doFriends();
}