if(mesh->invitation_addresses) {
for list_each(char, combo, mesh->invitation_addresses) {
hostname[n] = xstrdup(combo);
- char *colon = strchr(hostname[n], ':');
+ char *slash = strrchr(hostname[n], '/');
- if(colon) {
- *colon = 0;
- port[n] = xstrdup(colon + 1);
+ if(slash) {
+ *slash = 0;
+ port[n] = xstrdup(slash + 1);
}
n++;
}
}
- remove_duplicate_hostnames(hostname, port, 4);
+ remove_duplicate_hostnames(hostname, port, n);
// Resolve the hostnames
for(int i = 0; i < n; i++) {
char *combo;
if(port) {
- if(strchr(address, ':')) {
- xasprintf(&combo, "[%s]:%s", address, port);
- } else {
- xasprintf(&combo, "%s:%s", address, port);
- }
+ xasprintf(&combo, "%s/%s", address, port);
} else {
combo = xstrdup(address);
}