- asprintf(&envp[0], "NETNAME=%s", netname ? : "");
- asprintf(&envp[1], "DEVICE=%s", device ? : "");
- asprintf(&envp[2], "INTERFACE=%s", iface ? : "");
- asprintf(&envp[3], "NODE=%s", n->name);
- sockaddr2str(&n->address, &address, &port);
- asprintf(&envp[4], "REMOTEADDRESS=%s", address);
- asprintf(&envp[5], "REMOTEPORT=%s", port);
- envp[6] = NULL;
-
- asprintf(&name,
- n->status.reachable ? "hosts/%s-up" : "hosts/%s-down",
- n->name);
- execute_script(name, envp);
-
- free(name);
- free(address);
- free(port);
-
- for(i = 0; i < 7; i++)
- free(envp[i]);
+ timeout_del(&mesh->loop, &n->mtutimeout);
+
+ if(!n->status.blacklisted) {
+ update_node_status(mesh, n);
+ }
+
+ if(!n->status.reachable) {
+ update_node_udp(mesh, n, NULL);
+ n->status.broadcast = false;
+ n->options = 0;
+ } else if(n->connection) {
+ if(n->connection->outgoing) {
+ send_req_key(mesh, n);
+ }
+ }
+
+ if(n->utcp) {
+ utcp_offline(n->utcp, !n->status.reachable);
+ }