summaryrefslogtreecommitdiff
path: root/testing/DHT_test.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-10 14:21:06 -0700
committerirungentoo <irungentoo@gmail.com>2013-08-10 14:21:06 -0700
commit6c2b2806d10881a4c44a47e877898e9de1cc63c9 (patch)
tree2879741f06260a5390ae619954f53f141ba4ce54 /testing/DHT_test.c
parent341de59bb627600c27ef29b113fa71bac120350f (diff)
parent5b6465528f88c4ed45fe57d5c2c21270f9109bb9 (diff)
Merge pull request #415 from slvr/pr
Beginning to centralise packet handling
Diffstat (limited to 'testing/DHT_test.c')
-rw-r--r--testing/DHT_test.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index c8feaf4b..350093fd 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -156,14 +156,20 @@ int main(int argc, char *argv[])
156 bootstrap_ip_port.ip.i = inet_addr(argv[1]); 156 bootstrap_ip_port.ip.i = inet_addr(argv[1]);
157 DHT_bootstrap(bootstrap_ip_port, hex_string_to_bin(argv[3])); 157 DHT_bootstrap(bootstrap_ip_port, hex_string_to_bin(argv[3]));
158 158
159/*
159 IP_Port ip_port; 160 IP_Port ip_port;
160 uint8_t data[MAX_UDP_PACKET_SIZE]; 161 uint8_t data[MAX_UDP_PACKET_SIZE];
161 uint32_t length; 162 uint32_t length;
163*/
164
165 DHT_init();
166 friendreq_init();
162 167
163 while(1) { 168 while(1) {
164 169
165 doDHT(); 170 doDHT();
166 171
172/* slvrTODO:
167 while(receivepacket(&ip_port, data, &length) != -1) { 173 while(receivepacket(&ip_port, data, &length) != -1) {
168 if(DHT_handlepacket(data, length, ip_port) && friendreq_handlepacket(data, length, ip_port)) { 174 if(DHT_handlepacket(data, length, ip_port) && friendreq_handlepacket(data, length, ip_port)) {
169 //unhandled packet 175 //unhandled packet
@@ -172,11 +178,14 @@ int main(int argc, char *argv[])
172 printf("Received handled packet with length: %u\n", length); 178 printf("Received handled packet with length: %u\n", length);
173 } 179 }
174 } 180 }
181*/
182 networking_poll();
183
175 print_clientlist(); 184 print_clientlist();
176 print_friendlist(); 185 print_friendlist();
177 c_sleep(300); 186 c_sleep(300);
178 } 187 }
179 188
180 shutdown_networking(); 189 shutdown_networking();
181 return 0; 190 return 0;
182} 191}