- if(!config->connect.n) {
- config->connect.n = 2;
- config->connect.s = xcalloc(2, sizeof (char *));
- config->connect.s[0] = xstrdup("localhost");
- config->connect.s[1] = xstrdup("9999"); /* whatever */
- }
+ /* If a password is set assume we're good */
+ if(config->password)
+ return;
+ /* If we already have a host and/or port that's good too */
+ if(config->connect.af != -1)
+ return;
+ /* If there's a suitable socket that's probably what we wanted */
+ const char *s = config_get_file("socket");
+ struct stat st;
+ if(s && *s && stat(s, &st) == 0 && S_ISSOCK(st.st_mode))
+ return;
+ /* TODO can we use some mdns thing to find a DisOrder server? */