return true;
}
+bool send_error(meshlink_handle_t *mesh, connection_t *c, request_error_t err, const char *message) {
+ send_request(mesh, c, NULL, "%d %d %s", ERROR, err, message);
+ flush_meta(mesh, c);
+ return false;
+}
+
bool error_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
assert(request);
assert(*request);
logger(mesh, MESHLINK_INFO, "Error message from %s: %d: %s", c->name, err, errorstring);
+ switch(err) {
+ case BLACKLISTED:
+ if(mesh->blacklisted_cb) {
+ mesh->blacklisted_cb(mesh, (meshlink_node_t *)lookup_node(mesh, c->name));
+ }
+ }
+
return false;
}
/* Successful connection, reset timeout if this is an outgoing connection. */
- // TODO: completely remove this outgoing, let the autoconnect algorithm handle it
if(c->outgoing) {
- c->outgoing->timeout = 0;
- c->outgoing->state = OUTGOING_START;
-
- if(c->outgoing->ai) {
- freeaddrinfo(c->outgoing->ai);
- }
-
- c->outgoing->ai = NULL;
- c->outgoing->aip = NULL;
+ reset_outgoing(c->outgoing);
}
return true;