2018-07-17 06:46:02 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "../testing/misc_tools.h"
|
|
|
|
#include "check_compat.h"
|
2018-02-19 01:50:50 +08:00
|
|
|
|
2022-01-23 00:24:28 +08:00
|
|
|
typedef struct State {
|
|
|
|
uint32_t index;
|
|
|
|
uint64_t clock;
|
|
|
|
} State;
|
2020-05-17 19:36:34 +08:00
|
|
|
|
2022-01-23 00:24:28 +08:00
|
|
|
#include "run_auto_test.h"
|
2022-01-15 03:38:41 +08:00
|
|
|
|
2018-02-19 01:50:50 +08:00
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
|
|
|
|
|
|
|
struct Tox_Options *opts = tox_options_new(nullptr);
|
|
|
|
tox_options_set_udp_enabled(opts, false);
|
|
|
|
Tox *tox_tcp = tox_new_log(opts, nullptr, nullptr);
|
|
|
|
tox_options_free(opts);
|
|
|
|
|
2022-01-23 00:24:28 +08:00
|
|
|
bootstrap_toxes_live_network(&tox_tcp, 1, true);
|
2020-04-14 04:37:31 +08:00
|
|
|
|
2018-02-19 01:50:50 +08:00
|
|
|
printf("Waiting for connection");
|
|
|
|
|
2018-08-25 20:16:54 +08:00
|
|
|
do {
|
2018-02-19 01:50:50 +08:00
|
|
|
printf(".");
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
tox_iterate(tox_tcp, nullptr);
|
|
|
|
c_sleep(ITERATION_INTERVAL);
|
2018-08-25 20:16:54 +08:00
|
|
|
} while (tox_self_get_connection_status(tox_tcp) == TOX_CONNECTION_NONE);
|
2018-02-19 01:50:50 +08:00
|
|
|
|
2018-10-09 05:05:14 +08:00
|
|
|
const Tox_Connection status = tox_self_get_connection_status(tox_tcp);
|
2018-07-17 06:46:02 +08:00
|
|
|
ck_assert_msg(status == TOX_CONNECTION_TCP,
|
|
|
|
"expected TCP connection, but got %d", status);
|
|
|
|
printf("Connection (TCP): %d\n", status);
|
2018-02-19 01:50:50 +08:00
|
|
|
|
|
|
|
tox_kill(tox_tcp);
|
2022-01-23 00:24:28 +08:00
|
|
|
|
|
|
|
(void)run_auto_test;
|
|
|
|
|
2018-02-19 01:50:50 +08:00
|
|
|
return 0;
|
|
|
|
}
|