summaryrefslogtreecommitdiff
path: root/auto_tests
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-06-23 14:24:04 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-06-23 17:36:37 +0000
commitca75c014a41c2d207f705f49a9e0ce696dc0f0a7 (patch)
tree412596b5cea76b7f1f06dc3c7f457d5b09fa6a96 /auto_tests
parent64d115e52d3e506c360f221b67893ce41423716e (diff)
Disable UDP when proxy is enabled.
Currently, toxcore does not support UDP over proxies. In the future, we can relax this by disabling UDP only if the proxy doesn't support it.
Diffstat (limited to 'auto_tests')
-rw-r--r--auto_tests/invalid_proxy_test.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/auto_tests/invalid_proxy_test.c b/auto_tests/invalid_proxy_test.c
index 518ae55f..600efa9e 100644
--- a/auto_tests/invalid_proxy_test.c
+++ b/auto_tests/invalid_proxy_test.c
@@ -1,5 +1,5 @@
1// Test that if UDP is enabled, and an invalid proxy is provided, then we get a 1// Test that if UDP is enabled, and a proxy is provided that does not support
2// UDP connection only. 2// UDP proxying, we disable UDP.
3#ifndef _XOPEN_SOURCE 3#ifndef _XOPEN_SOURCE
4#define _XOPEN_SOURCE 600 4#define _XOPEN_SOURCE 600
5#endif 5#endif
@@ -13,6 +13,9 @@ static uint8_t const key[] = {
13 0x36, 0xAE, 0x2E, 0x5B, 0xA5, 0xE4, 0x69, 0x0E, 13 0x36, 0xAE, 0x2E, 0x5B, 0xA5, 0xE4, 0x69, 0x0E,
14}; 14};
15 15
16// Try to bootstrap for 30 seconds.
17#define NUM_ITERATIONS (unsigned)(30.0 / (ITERATION_INTERVAL / 1000.0))
18
16int main(void) 19int main(void)
17{ 20{
18 setvbuf(stdout, nullptr, _IONBF, 0); 21 setvbuf(stdout, nullptr, _IONBF, 0);
@@ -30,17 +33,13 @@ int main(void)
30 33
31 printf("Waiting for connection"); 34 printf("Waiting for connection");
32 35
33 while (tox_self_get_connection_status(tox) == TOX_CONNECTION_NONE) { 36 for (unsigned i = 0; i < NUM_ITERATIONS; i++) {
34 printf(".");
35 fflush(stdout);
36
37 tox_iterate(tox, nullptr); 37 tox_iterate(tox, nullptr);
38 c_sleep(ITERATION_INTERVAL); 38 c_sleep(ITERATION_INTERVAL);
39 // None of the iterations should have a connection.
40 assert(tox_self_get_connection_status(tox) == TOX_CONNECTION_NONE);
39 } 41 }
40 42
41 assert(tox_self_get_connection_status(tox) == TOX_CONNECTION_UDP);
42 printf("Connection (UDP): %d\n", tox_self_get_connection_status(tox));
43
44 tox_kill(tox); 43 tox_kill(tox);
45 return 0; 44 return 0;
46} 45}