The pre-init stage honors max-sockets as well.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 19 Mar 2008 23:11:39 +0000 (00:11 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 19 Mar 2008 23:11:39 +0000 (00:11 +0100)
src/proxyp.h
src/yaz-proxy-config.cpp
src/yaz-proxy.cpp

index cc19d99..311062c 100644 (file)
@@ -93,6 +93,7 @@ public:
                       int *limit_search,
                       int *target_idletime,
                       int *client_idletime,
+                      int *max_sockets,
                       int *max_clients,
                       int *keepalive_limit_bw,
                       int *keepalive_limit_pdu,
index edd5d85..7fe6204 100644 (file)
@@ -993,6 +993,7 @@ int Yaz_ProxyConfig::get_target_no(int no,
                                    int *limit_search,
                                    int *target_idletime,
                                    int *client_idletime,
+                                   int *max_sockets,
                                    int *max_clients,
                                    int *keepalive_limit_bw,
                                    int *keepalive_limit_pdu,
@@ -1029,7 +1030,7 @@ int Yaz_ProxyConfig::get_target_no(int no,
                     limit_bw, limit_pdu, limit_req,
                     limit_search,
                     target_idletime, client_idletime,
-                    0,
+                    max_sockets,
                     keepalive_limit_bw, keepalive_limit_pdu,
                     pre_init, cql2rpn,
                     negotiation_charset, negotiation_lang, target_charset,
index 147d066..eb7ce68 100644 (file)
@@ -3539,6 +3539,7 @@ void Yaz_Proxy::pre_init()
     const char *zurl_in_use[MAX_ZURL_PLEX];
     int limit_bw, limit_pdu, limit_req, limit_search;
     int target_idletime, client_idletime;
+    int max_sockets;
     int max_clients;
     int keepalive_limit_bw, keepalive_limit_pdu;
     int pre_init;
@@ -3560,6 +3561,7 @@ void Yaz_Proxy::pre_init()
                                           &limit_bw, &limit_pdu, &limit_req,
                                           &limit_search,
                                           &target_idletime, &client_idletime,
+                                          &max_sockets,
                                           &max_clients,
                                           &keepalive_limit_bw,
                                           &keepalive_limit_pdu,
@@ -3603,7 +3605,8 @@ void Yaz_Proxy::pre_init()
                         "sparew=%d preinit=%d",m_session_str,
                         name, zurl_in_use[j], in_use, other,
                         spare, spare_waiting, pre_init);
-                if (spare + spare_waiting < pre_init)
+                if (spare + spare_waiting < pre_init
+                    && in_use + spare + spare_waiting + other < max_sockets)
                 {
                     c = new Yaz_ProxyClient(m_PDU_Observable->clone(), this);
                     c->m_next = m_clientPool;