changeset 126:8efebf863404

Fix host handling.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 22 Jun 2014 06:20:03 +0300
parents 0ac59c798773
children 37bf3d8766b7
files th_network.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/th_network.c	Sun Jun 22 03:34:00 2014 +0300
+++ b/th_network.c	Sun Jun 22 06:20:03 2014 +0300
@@ -578,11 +578,12 @@
         return THERR_NULLPTR;
 
     conn->port = port;
-    if (host != NULL)
-    {
-        conn->host = th_strdup(host);
-        conn->hst = th_resolve_host(conn, host);
-    }
+    conn->host = th_strdup(host);
+    conn->hst = th_resolve_host(conn, host);
+    
+    // If name resolving locally fails, force to domain addr type
+    if (conn->hst == NULL)
+        conn->proxy.addr_type = TH_PROXY_ADDR_DOMAIN;
 
     th_get_addr(&(conn->addr), conn->hst);