diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-22 14:52:42 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-22 14:52:42 -0400 |
commit | 55361eac6f12fb2b2aaec427129aae65f5eb5e6b (patch) | |
tree | 41107d3aaa5edd4bc7e24951390ed676f00e8b2c /testing | |
parent | b368a6b4b898e2d2fa558931f724f2d204de6335 (diff) |
Modified the way friend requests worked.
Added routing of friend requests.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/DHT_test.c | 9 | ||||
-rw-r--r-- | testing/nTox.c | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/testing/DHT_test.c b/testing/DHT_test.c index 368609d0..9d599370 100644 --- a/testing/DHT_test.c +++ b/testing/DHT_test.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | //#include "../core/network.h" | 11 | //#include "../core/network.h" |
12 | #include "../core/DHT.c" | 12 | #include "../core/DHT.c" |
13 | #include "../core/friend_requests.c" | ||
13 | 14 | ||
14 | #include <string.h> | 15 | #include <string.h> |
15 | 16 | ||
@@ -45,7 +46,7 @@ void print_clientlist() | |||
45 | printf("\nTimestamp: %u", close_clientlist[i].timestamp); | 46 | printf("\nTimestamp: %u", close_clientlist[i].timestamp); |
46 | printf("\nLast pinged: %u\n", close_clientlist[i].last_pinged); | 47 | printf("\nLast pinged: %u\n", close_clientlist[i].last_pinged); |
47 | p_ip = close_clientlist[i].ret_ip_port; | 48 | p_ip = close_clientlist[i].ret_ip_port; |
48 | printf("\nOUR IP: %u.%u.%u.%u Port: %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)); | 49 | printf("OUR IP: %u.%u.%u.%u Port: %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)); |
49 | } | 50 | } |
50 | } | 51 | } |
51 | 52 | ||
@@ -81,7 +82,7 @@ void print_friendlist() | |||
81 | printf("\nTimestamp: %u", friends_list[k].client_list[i].timestamp); | 82 | printf("\nTimestamp: %u", friends_list[k].client_list[i].timestamp); |
82 | printf("\nLast pinged: %u\n", friends_list[k].client_list[i].last_pinged); | 83 | printf("\nLast pinged: %u\n", friends_list[k].client_list[i].last_pinged); |
83 | p_ip = friends_list[k].client_list[i].ret_ip_port; | 84 | p_ip = friends_list[k].client_list[i].ret_ip_port; |
84 | printf("\nret IP: %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)); | 85 | 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)); |
85 | } | 86 | } |
86 | } | 87 | } |
87 | } | 88 | } |
@@ -146,8 +147,6 @@ int main(int argc, char *argv[]) | |||
146 | init_networking(ip, PORT); | 147 | init_networking(ip, PORT); |
147 | 148 | ||
148 | 149 | ||
149 | |||
150 | |||
151 | perror("Initialization"); | 150 | perror("Initialization"); |
152 | IP_Port bootstrap_ip_port; | 151 | IP_Port bootstrap_ip_port; |
153 | bootstrap_ip_port.port = htons(atoi(argv[2])); | 152 | bootstrap_ip_port.port = htons(atoi(argv[2])); |
@@ -169,7 +168,7 @@ int main(int argc, char *argv[]) | |||
169 | 168 | ||
170 | while(receivepacket(&ip_port, data, &length) != -1) | 169 | while(receivepacket(&ip_port, data, &length) != -1) |
171 | { | 170 | { |
172 | if(DHT_handlepacket(data, length, ip_port)) | 171 | if(DHT_handlepacket(data, length, ip_port) && friendreq_handlepacket(data, length, ip_port)) |
173 | { | 172 | { |
174 | //unhandled packet | 173 | //unhandled packet |
175 | printpacket(data, length, ip_port); | 174 | printpacket(data, length, ip_port); |
diff --git a/testing/nTox.c b/testing/nTox.c index 50ceb92e..f7948778 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -251,7 +251,7 @@ int main(int argc, char *argv[]) | |||
251 | //if keyfiles exist | 251 | //if keyfiles exist |
252 | if(argc > 4){ | 252 | if(argc > 4){ |
253 | if(strncmp(argv[4], "nokey", 6) < 0){ | 253 | if(strncmp(argv[4], "nokey", 6) < 0){ |
254 | load_key(); | 254 | //load_key(); |
255 | } | 255 | } |
256 | } else { | 256 | } else { |
257 | load_key(); | 257 | load_key(); |