1
0
mirror of https://github.com/Tha14/toxic.git synced 2026-01-27 02:53:15 +01:00

Thread nodeslist loading

This is necessary because DNS/http lookups block, and can do so for a very long time
This commit is contained in:
Jfreegman
2016-09-22 14:09:07 -04:00
parent d2b572ede1
commit 38ec96e96a
4 changed files with 124 additions and 45 deletions

View File

@@ -26,13 +26,16 @@
/* Manages connection to the Tox DHT network. */
void do_tox_connection(Tox *m);
/* Load the DHT nodeslist to memory from json encoded nodes file obtained at NODES_LIST_URL.
* TODO: Parse json using a proper library?
/* Creates a new thread that will load the DHT nodeslist to memory
* from json encoded nodes file obtained at NODES_LIST_URL. Only one
* thread may run at a time.
*
* Return 0 on success.
* Return -1 if nodeslist file cannot be opened or created.
* Return -2 if nodeslist file cannot be parsed.
* Return -3 if nodeslist file does not contain any valid node entries.
* Return -1 if a thread is already active.
* Return -2 if mutex fails to init.
* Return -3 if pthread attribute fails to init.
* Return -4 if pthread fails to set detached state.
* Return -5 if thread creation fails.
*/
int load_DHT_nodeslist(void);