diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-02-18 17:50:50 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-02-18 21:32:28 +0000 |
commit | 3dc8cf6df8b80f213526884cafbbd493486366e5 (patch) | |
tree | 553b36ecd451c72ad85c7782ebbfd6a3ae41aaa7 /auto_tests/tcp_relay_test.c | |
parent | d016eb3f0e808ce4b4736b5056bcd3daf9514f99 (diff) |
Disable lan discovery in most tests.
Diffstat (limited to 'auto_tests/tcp_relay_test.c')
-rw-r--r-- | auto_tests/tcp_relay_test.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/auto_tests/tcp_relay_test.c b/auto_tests/tcp_relay_test.c new file mode 100644 index 00000000..4cda94f2 --- /dev/null +++ b/auto_tests/tcp_relay_test.c | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef _XOPEN_SOURCE | ||
2 | #define _XOPEN_SOURCE 600 | ||
3 | #endif | ||
4 | |||
5 | #include "helpers.h" | ||
6 | |||
7 | static uint8_t const key[] = { | ||
8 | 0xF4, 0x04, 0xAB, 0xAA, 0x1C, 0x99, 0xA9, 0xD3, | ||
9 | 0x7D, 0x61, 0xAB, 0x54, 0x89, 0x8F, 0x56, 0x79, | ||
10 | 0x3E, 0x1D, 0xEF, 0x8B, 0xD4, 0x6B, 0x10, 0x38, | ||
11 | 0xB9, 0xD8, 0x22, 0xE8, 0x46, 0x0F, 0xAB, 0x67, | ||
12 | }; | ||
13 | |||
14 | int main(void) | ||
15 | { | ||
16 | setvbuf(stdout, nullptr, _IONBF, 0); | ||
17 | |||
18 | struct Tox_Options *opts = tox_options_new(nullptr); | ||
19 | tox_options_set_udp_enabled(opts, false); | ||
20 | Tox *tox_tcp = tox_new_log(opts, nullptr, nullptr); | ||
21 | tox_options_free(opts); | ||
22 | |||
23 | tox_bootstrap(tox_tcp, "node.tox.biribiri.org", 33445, key, nullptr); | ||
24 | tox_add_tcp_relay(tox_tcp, "node.tox.biribiri.org", 33445, key, nullptr); | ||
25 | |||
26 | printf("Waiting for connection"); | ||
27 | |||
28 | while (tox_self_get_connection_status(tox_tcp) == TOX_CONNECTION_NONE) { | ||
29 | printf("."); | ||
30 | fflush(stdout); | ||
31 | |||
32 | tox_iterate(tox_tcp, nullptr); | ||
33 | c_sleep(ITERATION_INTERVAL); | ||
34 | } | ||
35 | |||
36 | printf("Connection (TCP): %d\n", tox_self_get_connection_status(tox_tcp)); | ||
37 | |||
38 | tox_kill(tox_tcp); | ||
39 | return 0; | ||
40 | } | ||