summaryrefslogtreecommitdiff
path: root/testing/DHT_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'testing/DHT_test.c')
-rw-r--r--testing/DHT_test.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index a9575fd5..8ab9157e 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -48,7 +48,7 @@
48 48
49#define PORT 33445 49#define PORT 33445
50 50
51void print_clientlist(DHT * dht) 51void print_clientlist(DHT *dht)
52{ 52{
53 uint32_t i, j; 53 uint32_t i, j;
54 IP_Port p_ip; 54 IP_Port p_ip;
@@ -71,7 +71,7 @@ void print_clientlist(DHT * dht)
71 } 71 }
72} 72}
73 73
74void print_friendlist(DHT * dht) 74void print_friendlist(DHT *dht)
75{ 75{
76 uint32_t i, j, k; 76 uint32_t i, j, k;
77 IP_Port p_ip; 77 IP_Port p_ip;
@@ -104,7 +104,7 @@ void print_friendlist(DHT * dht)
104 printf("\nIP: %u.%u.%u.%u:%u", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port)); 104 printf("\nIP: %u.%u.%u.%u:%u", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port));
105 printf("\nTimestamp: %llu", (long long unsigned int) dht->friends_list[k].client_list[i].timestamp); 105 printf("\nTimestamp: %llu", (long long unsigned int) dht->friends_list[k].client_list[i].timestamp);
106 printf("\nLast pinged: %llu\n", (long long unsigned int) dht->friends_list[k].client_list[i].last_pinged); 106 printf("\nLast pinged: %llu\n", (long long unsigned int) dht->friends_list[k].client_list[i].last_pinged);
107 p_ip =dht->friends_list[k].client_list[i].ret_ip_port; 107 p_ip = dht->friends_list[k].client_list[i].ret_ip_port;
108 printf("ret IP: %u.%u.%u.%u:%u\n", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port)); 108 printf("ret IP: %u.%u.%u.%u:%u\n", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port));
109 printf("Timestamp: %llu\n", (long long unsigned int)dht->friends_list[k].client_list[i].ret_timestamp); 109 printf("Timestamp: %llu\n", (long long unsigned int)dht->friends_list[k].client_list[i].ret_timestamp);
110 } 110 }
@@ -134,9 +134,10 @@ int main(int argc, char *argv[])
134 /* bind to ip 0.0.0.0:PORT */ 134 /* bind to ip 0.0.0.0:PORT */
135 IP ip; 135 IP ip;
136 ip.i = 0; 136 ip.i = 0;
137 137
138 DHT * dht = new_DHT(new_net_crypto(new_networking(ip, PORT))); 138 DHT *dht = new_DHT(new_net_crypto(new_networking(ip, PORT)));
139 init_cryptopackets(dht); 139 init_cryptopackets(dht);
140
140 if (argc < 4) { 141 if (argc < 4) {
141 printf("usage %s ip port public_key\n", argv[0]); 142 printf("usage %s ip port public_key\n", argv[0]);
142 exit(0); 143 exit(0);
@@ -198,5 +199,6 @@ int main(int argc, char *argv[])
198 print_friendlist(dht); 199 print_friendlist(dht);
199 c_sleep(300); 200 c_sleep(300);
200 } 201 }
202
201 return 0; 203 return 0;
202} 204}