mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
tabs -> spaces
This commit is contained in:
parent
8f6f8e221d
commit
7f27fcaf37
10
core/DHT.c
10
core/DHT.c
|
@ -1076,11 +1076,11 @@ static void doNAT(void)
|
|||
|
||||
void DHT_init(void)
|
||||
{
|
||||
networking_registerhandler(0, &handle_ping_request);
|
||||
networking_registerhandler(1, &handle_ping_response);
|
||||
networking_registerhandler(2, &handle_getnodes);
|
||||
networking_registerhandler(3, &handle_sendnodes);
|
||||
networking_registerhandler(254, &handle_NATping);
|
||||
networking_registerhandler(0, &handle_ping_request);
|
||||
networking_registerhandler(1, &handle_ping_response);
|
||||
networking_registerhandler(2, &handle_getnodes);
|
||||
networking_registerhandler(3, &handle_sendnodes);
|
||||
networking_registerhandler(254, &handle_NATping);
|
||||
}
|
||||
|
||||
void doDHT(void)
|
||||
|
|
|
@ -134,5 +134,5 @@ int send_LANdiscovery(uint16_t port)
|
|||
|
||||
void LANdiscovery_init(void)
|
||||
{
|
||||
networking_registerhandler(33, &handle_LANdiscovery);
|
||||
networking_registerhandler(33, &handle_LANdiscovery);
|
||||
}
|
||||
|
|
|
@ -772,9 +772,9 @@ static int handle_data(IP_Port source, uint8_t *packet, uint32_t length)
|
|||
|
||||
void LosslessUDP_init(void)
|
||||
{
|
||||
networking_registerhandler(16, &handle_handshake);
|
||||
networking_registerhandler(17, &handle_SYNC);
|
||||
networking_registerhandler(18, &handle_data);
|
||||
networking_registerhandler(16, &handle_handshake);
|
||||
networking_registerhandler(17, &handle_SYNC);
|
||||
networking_registerhandler(18, &handle_data);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -517,10 +517,10 @@ int initMessenger(void)
|
|||
if(init_networking(ip,PORT) == -1)
|
||||
return -1;
|
||||
|
||||
DHT_init();
|
||||
LosslessUDP_init();
|
||||
friendreq_init();
|
||||
LANdiscovery_init();
|
||||
DHT_init();
|
||||
LosslessUDP_init();
|
||||
friendreq_init();
|
||||
LANdiscovery_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -688,14 +688,14 @@ static void LANdiscovery(void)
|
|||
/* the main loop that needs to be run at least 200 times per second. */
|
||||
void doMessenger(void)
|
||||
{
|
||||
networking_poll();
|
||||
networking_poll();
|
||||
|
||||
doDHT();
|
||||
doLossless_UDP();
|
||||
doNetCrypto();
|
||||
doInbound();
|
||||
doFriends();
|
||||
LANdiscovery();
|
||||
doDHT();
|
||||
doLossless_UDP();
|
||||
doNetCrypto();
|
||||
doInbound();
|
||||
doFriends();
|
||||
LANdiscovery();
|
||||
}
|
||||
|
||||
/* returns the size of the messenger data (for saving) */
|
||||
|
|
|
@ -132,5 +132,5 @@ static int friendreq_handlepacket(IP_Port source, uint8_t * packet, uint32_t len
|
|||
|
||||
void friendreq_init(void)
|
||||
{
|
||||
networking_registerhandler(32, &friendreq_handlepacket);
|
||||
networking_registerhandler(32, &friendreq_handlepacket);
|
||||
}
|
||||
|
|
|
@ -92,21 +92,21 @@ static packet_handler_callback packethandlers[256] = {0};
|
|||
|
||||
void networking_registerhandler(uint8_t byte, packet_handler_callback cb)
|
||||
{
|
||||
packethandlers[byte] = cb;
|
||||
packethandlers[byte] = cb;
|
||||
}
|
||||
|
||||
void networking_poll()
|
||||
{
|
||||
IP_Port ip_port;
|
||||
uint8_t data[MAX_UDP_PACKET_SIZE];
|
||||
uint32_t length;
|
||||
|
||||
while (receivepacket(&ip_port, data, &length) != -1)
|
||||
{
|
||||
if (length < 1) continue;
|
||||
if (!packethandlers[data[0]]) continue;
|
||||
packethandlers[data[0]](ip_port, data, length);
|
||||
}
|
||||
IP_Port ip_port;
|
||||
uint8_t data[MAX_UDP_PACKET_SIZE];
|
||||
uint32_t length;
|
||||
|
||||
while (receivepacket(&ip_port, data, &length) != -1)
|
||||
{
|
||||
if (length < 1) continue;
|
||||
if (!packethandlers[data[0]]) continue;
|
||||
packethandlers[data[0]](ip_port, data, length);
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize networking
|
||||
|
|
|
@ -136,7 +136,7 @@ void Lossless_UDP()
|
|||
/* } */
|
||||
/* }*/
|
||||
|
||||
networking_poll();
|
||||
networking_poll();
|
||||
|
||||
doLossless_UDP();
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ void Lossless_UDP()
|
|||
//}
|
||||
// }
|
||||
|
||||
networking_poll();
|
||||
networking_poll();
|
||||
|
||||
doLossless_UDP();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user