Use hostport, not ipport for proxied connections
[pazpar2-moved-to-github.git] / src / connection.c
index 0d77a90..c55785d 100644 (file)
@@ -194,8 +194,8 @@ static void non_block_events(struct connection *co)
             continue;
         ev = ZOOM_connection_last_event(link);
         
-#if 0
-        yaz_log(YLOG_LOG, "%p Connection ZOOM_EVENT_%s", co, ZOOM_get_event_str(ev));
+#if 1
+        yaz_log(YLOG_DEBUG, "%p Connection ZOOM_EVENT_%s", co, ZOOM_get_event_str(ev));
 #endif
         switch (ev) 
         {
@@ -251,6 +251,7 @@ static void non_block_events(struct connection *co)
         struct client *cl = co->client;
         if (cl)
         {
+            client_check_preferred_watch(cl);
             client_got_records(cl);
         }
     }
@@ -431,6 +432,8 @@ static int connection_connect(struct connection *con, iochan_man_t iochan_man)
         strcat(http_hostport, host->hostport);
         ZOOM_connection_connect(link, http_hostport, 0);
     }
+    else if (zproxy && *zproxy)
+        ZOOM_connection_connect(link, host->hostport, 0);        
     else
         ZOOM_connection_connect(link, host->ipport, 0);
     
@@ -471,7 +474,7 @@ int client_prep_connection(struct client *cl,
     if (!co)
     {
         int max_connections = 0;
-        int reuse_connection = 0;
+        int reuse_connections = 1;
         const char *v = session_setting_oneval(client_get_database(cl),
                                                PZ_MAX_CONNECTIONS);
         if (v && *v)
@@ -490,8 +493,8 @@ int client_prep_connection(struct client *cl,
             int num_connections = 0;
             for (co = host->connections; co; co = co->next)
                 num_connections++;
-            if (reuse_connection) {
-                for (co = host->connections; reuse_connection && co; co = co->next)
+            if (reuse_connections) {
+                for (co = host->connections; co; co = co->next)
                 {
                     if (connection_is_idle(co) &&
                         (!co->client || client_get_state(co->client) == Client_Idle) &&