}
}
- struct addrinfo *ai, hint = {};
+ struct addrinfo *ai;
- hint.ai_family = addressfamily;
-
- hint.ai_socktype = SOCK_STREAM;
-
- hint.ai_protocol = IPPROTO_TCP;
-
- hint.ai_flags = AI_PASSIVE;
+ struct addrinfo hint = {
+ .ai_family = addressfamily,
+ .ai_socktype = SOCK_STREAM,
+ .ai_protocol = IPPROTO_TCP,
+ .ai_flags = AI_PASSIVE,
+ };
int err = getaddrinfo(address && *address ? address : NULL, port, &hint, &ai);
read_host_config(mesh, mesh->config, name);
if(!get_config_string(lookup_config(mesh->config, "Port"), &mesh->myport)) {
- logger(mesh, MESHLINK_ERROR, "Port for MeshLink instance required!");
- return false;
+ int port = check_port(mesh);
+
+ if(port == 0) {
+ return false;
+ }
+
+ xasprintf(&mesh->myport, "%d", port);
}
mesh->self->connection->options = 0;