+ Yaz_ProxyClient *c_min = 0;
+ int min_seq = -1;
+ int no_of_clients = 0;
+ for (c = parent->m_clientPool; c; c = c->m_next)
+ {
+ no_of_clients++;
+ logf (LOG_LOG, "found seqno = %d", c->m_seqno);
+ if (min_seq < 0 || c->m_seqno < min_seq)
+ {
+ min_seq = c->m_seqno;
+ c_min = c;
+ }
+ }
+ if (no_of_clients >= parent->m_max_clients)
+ {
+ c = c_min;
+ logf (LOG_LOG, "Yaz_Proxy::get_client re-using session %d",
+ c->m_seqno);
+ if (c->m_server)
+ delete c->m_server;
+ c->m_server = 0;
+ }
+ else
+ {
+ logf (LOG_LOG, "Yaz_Proxy::get_client making new session");
+ c = new Yaz_ProxyClient(m_PDU_Observable->clone());
+ c->m_next = parent->m_clientPool;
+ if (c->m_next)
+ c->m_next->m_prev = &c->m_next;
+ parent->m_clientPool = c;
+ c->m_prev = &parent->m_clientPool;
+ }