if(report && c->node && !c->node->status.reachable) {
edge_t *e;
e = lookup_edge(c->node, mesh->self);
if(report && c->node && !c->node->status.reachable) {
edge_t *e;
e = lookup_edge(c->node, mesh->self);
#ifndef HAVE_MINGW
/* Clean up dead proxy processes */
while(waitpid(-1, NULL, WNOHANG) > 0);
#ifndef HAVE_MINGW
/* Clean up dead proxy processes */
while(waitpid(-1, NULL, WNOHANG) > 0);
for list_each(connection_t, c, mesh->connections) {
// Also make sure that if outstanding key requests for the UDP counterpart of a connection has timed out, we restart it.
if(c->node) {
for list_each(connection_t, c, mesh->connections) {
// Also make sure that if outstanding key requests for the UDP counterpart of a connection has timed out, we restart it.
if(c->node) {
logger(mesh, MESHLINK_INFO, "%s didn't respond to PING in %ld seconds", c->name, (long)mesh->loop.now.tv_sec - c->last_ping_time);
logger(mesh, MESHLINK_INFO, "%s didn't respond to PING in %ld seconds", c->name, (long)mesh->loop.now.tv_sec - c->last_ping_time);
logger(mesh, MESHLINK_WARNING, "Timeout while connecting to %s", c->name);
logger(mesh, MESHLINK_WARNING, "Timeout while connecting to %s", c->name);
logger(mesh, MESHLINK_WARNING, "Timeout from %s during authentication", c->name);
logger(mesh, MESHLINK_WARNING, "Timeout from %s during authentication", c->name);
static int node_compare_devclass_asc_lsc_desc(const void *a, const void *b) {
const node_t *na = a, *nb = b;
static int node_compare_devclass_asc_lsc_desc(const void *a, const void *b) {
const node_t *na = a, *nb = b;
static int node_compare_lsc_desc(const void *a, const void *b) {
const node_t *na = a, *nb = b;
static int node_compare_lsc_desc(const void *a, const void *b) {
const node_t *na = a, *nb = b;
static int node_compare_devclass_desc(const void *a, const void *b) {
const node_t *na = a, *nb = b;
static int node_compare_devclass_desc(const void *a, const void *b) {
const node_t *na = a, *nb = b;
logger(mesh, MESHLINK_WARNING, "Possible node with same Name as us! Sleeping %d seconds.", mesh->sleeptime);
usleep(mesh->sleeptime * 1000000LL);
mesh->sleeptime *= 2;
logger(mesh, MESHLINK_WARNING, "Possible node with same Name as us! Sleeping %d seconds.", mesh->sleeptime);
usleep(mesh->sleeptime * 1000000LL);
mesh->sleeptime *= 2;
unsigned int cur_connects = 0;
for list_each(connection_t, c, mesh->connections) {
unsigned int cur_connects = 0;
for list_each(connection_t, c, mesh->connections) {
}
logger(mesh, MESHLINK_DEBUG, "* cur_connects = %d", cur_connects);
}
logger(mesh, MESHLINK_DEBUG, "* cur_connects = %d", cur_connects);
for splay_each(node_t, n, mesh->nodes) {
logger(mesh, MESHLINK_DEBUG, "* n->devclass = %d", n->devclass);
for splay_each(node_t, n, mesh->nodes) {
logger(mesh, MESHLINK_DEBUG, "* n->devclass = %d", n->devclass);
for(unsigned int devclass = 0; devclass <= mesh->devclass; ++devclass) {
for list_each(connection_t, c, mesh->connections) {
for(unsigned int devclass = 0; devclass <= mesh->devclass; ++devclass) {
for list_each(connection_t, c, mesh->connections) {
}
if(connects < min_connects) {
splay_tree_t *nodes = splay_alloc_tree(node_compare_lsc_desc, NULL);
for splay_each(node_t, n, mesh->nodes) {
}
if(connects < min_connects) {
splay_tree_t *nodes = splay_alloc_tree(node_compare_lsc_desc, NULL);
for splay_each(node_t, n, mesh->nodes) {
splay_tree_t *nodes = splay_alloc_tree(node_compare_devclass_asc_lsc_desc, NULL);
for splay_each(node_t, n, mesh->nodes) {
splay_tree_t *nodes = splay_alloc_tree(node_compare_devclass_asc_lsc_desc, NULL);
for splay_each(node_t, n, mesh->nodes) {
}
if(nodes->head) {
logger(mesh, MESHLINK_DEBUG, "* try to heal partition");
connect_to = (node_t *)nodes->head->data;
}
if(nodes->head) {
logger(mesh, MESHLINK_DEBUG, "* try to heal partition");
connect_to = (node_t *)nodes->head->data;
for list_each(outgoing_t, outgoing, mesh->outgoings) {
if(!strcmp(outgoing->name, connect_to->name)) {
found = true;
for list_each(outgoing_t, outgoing, mesh->outgoings) {
if(!strcmp(outgoing->name, connect_to->name)) {
found = true;
outgoing->name = xstrdup(connect_to->name);
list_insert_tail(mesh->outgoings, outgoing);
setup_outgoing_connection(mesh, outgoing);
outgoing->name = xstrdup(connect_to->name);
list_insert_tail(mesh->outgoings, outgoing);
setup_outgoing_connection(mesh, outgoing);
for(unsigned int devclass = 0; devclass <= mesh->devclass; ++devclass) {
for list_each(connection_t, c, mesh->connections) {
for(unsigned int devclass = 0; devclass <= mesh->devclass; ++devclass) {
for list_each(connection_t, c, mesh->connections) {
}
if(min_connects < connects) {
splay_tree_t *nodes = splay_alloc_tree(node_compare_devclass_desc, NULL);
for list_each(connection_t, c, mesh->connections) {
}
if(min_connects < connects) {
splay_tree_t *nodes = splay_alloc_tree(node_compare_devclass_desc, NULL);
for list_each(connection_t, c, mesh->connections) {
splay_tree_t *nodes = splay_alloc_tree(node_compare_devclass_desc, NULL);
for list_each(connection_t, c, mesh->connections) {
splay_tree_t *nodes = splay_alloc_tree(node_compare_devclass_desc, NULL);
for list_each(connection_t, c, mesh->connections) {
logger(mesh, MESHLINK_DEBUG, "* no node we want to disconnect, even though we have too many connections");
logger(mesh, MESHLINK_DEBUG, "* no node we want to disconnect, even though we have too many connections");
/* Reset the reconnection timers for all outgoing connections */
for list_each(outgoing_t, outgoing, mesh->outgoings) {
outgoing->timeout = 0;
/* Reset the reconnection timers for all outgoing connections */
for list_each(outgoing_t, outgoing, mesh->outgoings) {
outgoing->timeout = 0;
/* Check for outgoing connections that are in progress, and reset their ping timers */
for list_each(connection_t, c, mesh->connections) {
/* Check for outgoing connections that are in progress, and reset their ping timers */
for list_each(connection_t, c, mesh->connections) {