void terminate_connection(meshlink_handle_t *mesh, connection_t *c, bool report) {
logger(mesh, MESHLINK_INFO, "Closing connection with %s", c->name);
void terminate_connection(meshlink_handle_t *mesh, connection_t *c, bool report) {
logger(mesh, MESHLINK_INFO, "Closing connection with %s", c->name);
if(c->edge) {
if(report) {
send_del_edge(mesh, mesh->everyone, c->edge, 0);
if(c->edge) {
if(report) {
send_del_edge(mesh, mesh->everyone, c->edge, 0);
if(c->status.active) {
if(c->status.pinged) {
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);
if(c->status.active) {
if(c->status.pinged) {
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);