- if(get_config_int(lookup_config(config_tree, "MaxTimeout"), &maxtimeout)) {
- if(maxtimeout <= 0) {
- logger(LOG_ERR, "Bogus maximum timeout!");
- return false;
+ if(!name) {
+ return NULL;
+ }
+
+ if(!check_id(name)) {
+ logger(mesh, MESHLINK_ERROR, "Invalid name for mesh->self!");
+ free(name);
+ return NULL;
+ }
+
+ return name;
+}
+
+bool setup_myself_reloadable(meshlink_handle_t *mesh) {
+ mesh->localdiscovery = true;
+ keylifetime = 3600; // TODO: check if this can be removed as well
+ mesh->maxtimeout = 900;
+ mesh->self->options |= OPTION_PMTU_DISCOVERY;
+
+ read_invitation_key(mesh);
+
+ return true;
+}
+
+/*
+ Add listening sockets.
+*/
+static bool add_listen_address(meshlink_handle_t *mesh, char *address, bool bindto) {
+ char *port = mesh->myport;
+
+ if(address) {
+ char *space = strchr(address, ' ');
+
+ if(space) {
+ *space++ = 0;
+ port = space;