use DEBUG define to turn on some printfs.

This commit is contained in:
irungentoo 2013-07-14 11:40:42 -04:00
parent 71abd15c1b
commit 084185a2c2

View File

@ -341,18 +341,24 @@ void doMessenger()
uint32_t length; uint32_t length;
while(receivepacket(&ip_port, data, &length) != -1) while(receivepacket(&ip_port, data, &length) != -1)
{ {
#ifdef DEBUG
//if(rand() % 3 != 1)//simulate packet loss //if(rand() % 3 != 1)//simulate packet loss
//{ //{
if(DHT_handlepacket(data, length, ip_port) && LosslessUDP_handlepacket(data, length, ip_port)) if(DHT_handlepacket(data, length, ip_port) && LosslessUDP_handlepacket(data, length, ip_port))
{ {
//if packet is discarded //if packet is discarded
//printf("Received unhandled packet with length: %u\n", length); printf("Received unhandled packet with length: %u\n", length);
} }
else else
{ {
//printf("Received handled packet with length: %u\n", length); printf("Received handled packet with length: %u\n", length);
} }
//} //}
#else
DHT_handlepacket(data, length, ip_port);
LosslessUDP_handlepacket(data, length, ip_port);
#endif
} }
doDHT(); doDHT();
doLossless_UDP(); doLossless_UDP();