mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-27 04:53:27 +01:00
connect to limited number of nodes on init instead of all of them
This commit is contained in:
parent
e7920d1da7
commit
2d9f4facf7
@ -205,6 +205,8 @@ int init_connection_helper(Tox *m, int line)
|
|||||||
*/
|
*/
|
||||||
static bool srvlist_loaded = false;
|
static bool srvlist_loaded = false;
|
||||||
|
|
||||||
|
#define NUM_INIT_NODES 5
|
||||||
|
|
||||||
int init_connection(Tox *m)
|
int init_connection(Tox *m)
|
||||||
{
|
{
|
||||||
if (linecnt > 0) /* already loaded serverlist */
|
if (linecnt > 0) /* already loaded serverlist */
|
||||||
@ -231,10 +233,11 @@ int init_connection(Tox *m)
|
|||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
res = 3;
|
res = 3;
|
||||||
int line;
|
int i;
|
||||||
|
int n = MIN(NUM_INIT_NODES, linecnt);
|
||||||
|
|
||||||
for(line = 0; line < linecnt; line++)
|
for(i = 0; i < n; ++i)
|
||||||
if (init_connection_helper(m, line))
|
if (init_connection_helper(m, rand() % linecnt))
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Toxic -- Tox Curses Client
|
* Toxic -- Tox Curses Client
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||||
|
|
||||||
/* convert a hex string to binary */
|
/* convert a hex string to binary */
|
||||||
|
Loading…
Reference in New Issue
Block a user