summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorAstonex <softukitu@gmail.com>2013-07-30 01:27:48 +0100
committerAstonex <softukitu@gmail.com>2013-07-30 01:27:48 +0100
commit59ccce35a6afd8e98c28c26d8a53b1880cb16ba8 (patch)
tree1870f42970c945de3cfef453705f6fb0e1956121 /testing
parent7e973c8cac08acb5724b5e1f462faf539b647a8f (diff)
Added multi-threading so user input doens't hold up checking the network
Diffstat (limited to 'testing')
-rw-r--r--testing/nTox_win32.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/testing/nTox_win32.c b/testing/nTox_win32.c
index 6e71a436..51f31001 100644
--- a/testing/nTox_win32.c
+++ b/testing/nTox_win32.c
@@ -24,6 +24,8 @@
24#include "nTox_win32.h" 24#include "nTox_win32.h"
25#include "misc_tools.h" 25#include "misc_tools.h"
26 26
27#include <process.h>
28
27uint8_t pending_requests[256][CLIENT_ID_SIZE]; 29uint8_t pending_requests[256][CLIENT_ID_SIZE];
28uint8_t num_requests; 30uint8_t num_requests;
29 31
@@ -200,6 +202,15 @@ void line_eval(char* line)
200 } 202 }
201} 203}
202 204
205void get_input()
206{
207 while(1) {
208 fgets(line, STRING_LENGTH, stdin);
209 line_eval(line);
210 strcpy(line, "");
211 }
212}
213
203int main(int argc, char *argv[]) 214int main(int argc, char *argv[])
204{ 215{
205 if (argc < 4) { 216 if (argc < 4) {
@@ -264,6 +275,8 @@ int main(int argc, char *argv[])
264 int c; 275 int c;
265 int on = 0; 276 int on = 0;
266 277
278 _beginthread(get_input, 0, NULL);
279
267 while(1) { 280 while(1) {
268 if (on == 0 && DHT_isconnected()) { 281 if (on == 0 && DHT_isconnected()) {
269 printf("\n[i] connected to DHT\n\n"); 282 printf("\n[i] connected to DHT\n\n");
@@ -271,12 +284,6 @@ int main(int argc, char *argv[])
271 } 284 }
272 285
273 doMessenger(); 286 doMessenger();
274
275 fgets(line, STRING_LENGTH, stdin);
276
277 line_eval(line);
278
279 strcpy(line, "");
280 } 287 }
281 288
282 return 0; 289 return 0;