Browse Source

Warn if port is not specified in connectTo

jeffl35 7 years ago
parent
commit
273fa86ecf
1 changed files with 12 additions and 6 deletions
  1. 12 6
      client/Configurator.c

+ 12 - 6
client/Configurator.c

@@ -216,12 +216,18 @@ static void udpInterface(Dict* config, struct Context* ctx)
                 key = String_clone(key, perCallAlloc);
                 char* lastColon = CString_strrchr(key->bytes, ':');
 
-                if (!Sockaddr_parse(key->bytes, NULL)) {
-                    // it's a sockaddr, fall through
-                } else if (lastColon) {
-                    // try it as a hostname.
-                    Log_critical(ctx->logger, "Couldn't add connection [%s], "
-                                                "hostnames aren't supported.", key->bytes);
+                if (lastColon) {
+                    if (!Sockaddr_parse(key->bytes, NULL)) {
+                        // it's a sockaddr, fall through
+                    } else {
+                        // try it as a hostname.
+                        Log_critical(ctx->logger, "Couldn't add connection [%s], "
+                                                    "hostnames aren't supported.", key->bytes);
+                        exit(-1);
+                    }
+                } else {
+                    // it doesn't have a port
+                    Log_critical(ctx->logger, "Missing port in connection [%s].", key->bytes);
                     exit(-1);
                 }
                 Dict_putInt(value, String_CONST("interfaceNumber"), ifNum, perCallAlloc);