retry(mesh);
}
-void call_error_cb(meshlink_handle_t *mesh) {
+void call_error_cb(meshlink_handle_t *mesh, meshlink_errno_t meshlink_errno) {
// We should only call the callback function if we are in the background thread.
if(!mesh->error_cb) {
return;
extern meshlink_log_cb_t global_log_cb;
extern void handle_duplicate_node(meshlink_handle_t *mesh, struct node_t *n);
extern void handle_network_change(meshlink_handle_t *mesh, bool online);
-extern void call_error_cb(meshlink_handle_t *mesh);
+extern void call_error_cb(meshlink_handle_t *mesh, meshlink_errno_t meshlink_errno);
/// Per-instance PRNG
static inline int prng(meshlink_handle_t *mesh, uint64_t max) {
config_t config = {buf, packmsg_output_size(&out, buf)};
if(!config_write(mesh, "current", n->name, &config, mesh->config_key)) {
- call_error_cb(mesh);
+ call_error_cb(mesh, MESHLINK_ESTORAGE);
return false;
}
n->devclass = DEV_CLASS_UNKNOWN;
n->ecdsa = ecdsa_set_public_key(data);
n->submesh = c->submesh;
+
+ if(!node_write_config(mesh, n)) {
+ logger(mesh, MESHLINK_ERROR, "Error writing configuration file for invited node %s!\n", c->name);
+ free_node(n);
+ return false;
+
+ }
+
node_add(mesh, n);
- node_write_config(mesh, n);
logger(mesh, MESHLINK_INFO, "Key successfully received from %s", c->name);