summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-09-21 02:02:27 +0200
committerCoren[m] <Break@Ocean>2013-09-21 02:02:27 +0200
commit330c1bee5ce3ccbca77f62336bfa84a0752a58ff (patch)
tree26187564d80745b452c85967be5610a6efbfaa28
parent20b6900fb181f71eca4577a5f1e1f5f3ecd6a28b (diff)
nTox: keep bootstrap()ping every 10 seconds, until we get a connection running (the initial one might get lost, it IS done via UDP after all)
nTox.c: - main(): keep calling tox_bootstrap_from_address() every 10 seconds, until the connection is established
-rw-r--r--testing/nTox.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/testing/nTox.c b/testing/nTox.c
index 33c8ab85..a9af5239 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -667,10 +667,19 @@ int main(int argc, char *argv[])
667 new_lines(whoami); 667 new_lines(whoami);
668 } 668 }
669 669
670 time_t timestamp0 = time(NULL);
670 while (1) { 671 while (1) {
671 if (on == 0 && tox_isconnected(m)) { 672 if (on == 0) {
672 new_lines("[i] connected to DHT"); 673 if (tox_isconnected(m)) {
673 on = 1; 674 new_lines("[i] connected to DHT");
675 on = 1;
676 } else {
677 time_t timestamp1 = time(NULL);
678 if (timestamp0 + 10 < timestamp1) {
679 timestamp0 = timestamp1;
680 tox_bootstrap_from_address(m, argv[argvoffset + 1], ipv6enabled, port, binary_string);
681 }
682 }
674 } 683 }
675 684
676 tox_do(m); 685 tox_do(m);