forked from Green-Sky/tomato
Squashed 'external/toxcore/c-toxcore/' changes from 640e6cace..e58eb27a8
e58eb27a8 fix(toxav): remove extra copy of video frame on encode Tested and works, but there might be alignment issues and other stuff. 206ea3530 refactor: Explicitly pass dependencies to constructors. 7cefa93cf fix(toxencryptsave): Wipe salt and passkey after usage. 7c3be2342 refactor: Add file/line to tox-bootstrapd logging. f84e8cdce refactor: Move loglogdata out of network.c. 390f7db06 refactor: Move random and memory OS-specifics to `os_*` files. REVERT: 640e6cace fix(toxav): remove extra copy of video frame on encode Tested and works, but there might be alignment issues and other stuff. git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: e58eb27a84f9fa0cd996868e079f39e90a5c04b6
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include "../toxcore/network.h"
|
||||
#include "../toxcore/onion.h"
|
||||
#include "../toxcore/onion_announce.h"
|
||||
#include "../toxcore/os_memory.h"
|
||||
#include "../toxcore/os_random.h"
|
||||
#include "../toxcore/tox.h"
|
||||
|
||||
#define TCP_RELAY_ENABLED
|
||||
@@ -157,14 +159,15 @@ int main(int argc, char *argv[])
|
||||
Mono_Time *mono_time = mono_time_new(mem, nullptr, nullptr);
|
||||
const uint16_t start_port = PORT;
|
||||
const uint16_t end_port = start_port + (TOX_PORTRANGE_TO - TOX_PORTRANGE_FROM);
|
||||
DHT *dht = new_dht(logger, mem, rng, ns, mono_time, new_networking_ex(logger, mem, ns, &ip, start_port, end_port, nullptr), true, true);
|
||||
Onion *onion = new_onion(logger, mem, mono_time, rng, dht);
|
||||
Forwarding *forwarding = new_forwarding(logger, mem, rng, mono_time, dht);
|
||||
Networking_Core *net = new_networking_ex(logger, mem, ns, &ip, start_port, end_port, nullptr);
|
||||
DHT *dht = new_dht(logger, mem, rng, ns, mono_time, net, true, true);
|
||||
Onion *onion = new_onion(logger, mem, mono_time, rng, dht, net);
|
||||
Forwarding *forwarding = new_forwarding(logger, mem, rng, mono_time, dht, net);
|
||||
GC_Announces_List *gc_announces_list = new_gca_list(mem);
|
||||
Onion_Announce *onion_a = new_onion_announce(logger, mem, rng, mono_time, dht);
|
||||
Onion_Announce *onion_a = new_onion_announce(logger, mem, rng, mono_time, dht, net);
|
||||
|
||||
#ifdef DHT_NODE_EXTRA_PACKETS
|
||||
bootstrap_set_callbacks(dht_get_net(dht), (uint32_t)DAEMON_VERSION_NUMBER, (const uint8_t *) motd_str, strlen(motd_str) + 1);
|
||||
bootstrap_set_callbacks(net, (uint32_t)DAEMON_VERSION_NUMBER, (const uint8_t *) motd_str, strlen(motd_str) + 1);
|
||||
#endif
|
||||
|
||||
if (onion == nullptr || forwarding == nullptr || onion_a == nullptr) {
|
||||
@@ -214,7 +217,7 @@ int main(int argc, char *argv[])
|
||||
fclose(file);
|
||||
|
||||
printf("\n");
|
||||
printf("Port: %u\n", net_ntohs(net_port(dht_get_net(dht))));
|
||||
printf("Port: %u\n", net_ntohs(net_port(net)));
|
||||
|
||||
if (argc > argvoffset + 3) {
|
||||
printf("Trying to bootstrap into the network...\n");
|
||||
@@ -258,7 +261,7 @@ int main(int argc, char *argv[])
|
||||
do_dht(dht);
|
||||
|
||||
if (mono_time_is_timeout(mono_time, last_lan_discovery, is_waiting_for_dht_connection ? 5 : LAN_DISCOVERY_INTERVAL)) {
|
||||
lan_discovery_send(dht_get_net(dht), broadcast, dht_get_self_public_key(dht), net_htons(PORT));
|
||||
lan_discovery_send(net, broadcast, dht_get_self_public_key(dht), net_htons(PORT));
|
||||
last_lan_discovery = mono_time_get(mono_time);
|
||||
}
|
||||
|
||||
@@ -267,7 +270,7 @@ int main(int argc, char *argv[])
|
||||
#ifdef TCP_RELAY_ENABLED
|
||||
do_tcp_server(tcp_s, mono_time);
|
||||
#endif
|
||||
networking_poll(dht_get_net(dht), nullptr);
|
||||
networking_poll(net, nullptr);
|
||||
|
||||
c_sleep(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user