From: Adam Dickmeiss Date: Mon, 13 Aug 2001 16:39:12 +0000 (+0000) Subject: PDU_Assoc keeps track of children. Using yaz_log instead of logf. X-Git-Tag: YAZPP.0.3~27 X-Git-Url: http://git.indexdata.com/?p=yazpp-moved-to-github.git;a=commitdiff_plain;h=c96f00d22f0af97ad7fd5d8687fa0b65b67de77e PDU_Assoc keeps track of children. Using yaz_log instead of logf. --- diff --git a/src/yaz-ir-assoc.cpp b/src/yaz-ir-assoc.cpp index 42c4fbb..d30eab3 100644 --- a/src/yaz-ir-assoc.cpp +++ b/src/yaz-ir-assoc.cpp @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: yaz-ir-assoc.cpp,v $ - * Revision 1.15 2001-04-26 12:17:49 heikki + * Revision 1.16 2001-08-13 16:39:12 adam + * PDU_Assoc keeps track of children. Using yaz_log instead of logf. + * + * Revision 1.15 2001/04/26 12:17:49 heikki * Ursula stuff, mostly in the test client * * Revision 1.14 2000/10/11 11:58:16 adam @@ -86,7 +89,7 @@ typedef char *charp; void Yaz_IR_Assoc::set_databaseNames (int num, const char **list) { int i; - logf (m_log, "Yaz_IR_Assoc::set_databaseNames num=%d", num); + yaz_log (m_log, "Yaz_IR_Assoc::set_databaseNames num=%d", num); for (i = 0; iwhich; switch (apdu->which) { case Z_APDU_initResponse: - logf (m_log, "recv InitResponse"); - recv_initResponse(apdu->u.initResponse); - break; + yaz_log (m_log, "recv InitResponse"); + recv_initResponse(apdu->u.initResponse); + break; case Z_APDU_initRequest: - logf (m_log, "recv InitRequest"); - recv_initRequest(apdu->u.initRequest); + yaz_log (m_log, "recv InitRequest"); + recv_initRequest(apdu->u.initRequest); break; case Z_APDU_searchRequest: - logf (m_log, "recv searchRequest"); - recv_searchRequest(apdu->u.searchRequest); + yaz_log (m_log, "recv searchRequest"); + recv_searchRequest(apdu->u.searchRequest); break; case Z_APDU_searchResponse: - logf (m_log, "recv searchResponse"); - recv_searchResponse(apdu->u.searchResponse); - break; + yaz_log (m_log, "recv searchResponse"); + recv_searchResponse(apdu->u.searchResponse); + break; case Z_APDU_presentRequest: - logf (m_log, "recv presentRequest"); - recv_presentRequest(apdu->u.presentRequest); + yaz_log (m_log, "recv presentRequest"); + recv_presentRequest(apdu->u.presentRequest); break; case Z_APDU_presentResponse: - logf (m_log, "recv presentResponse"); - recv_presentResponse(apdu->u.presentResponse); + yaz_log (m_log, "recv presentResponse"); + recv_presentResponse(apdu->u.presentResponse); break; case Z_APDU_extendedServicesResponse: - logf (m_log, "recv extendedServiceResponse"); + yaz_log (m_log, "recv extendedServiceResponse"); recv_extendedServicesResponse(apdu->u.extendedServicesResponse); break; } @@ -249,7 +252,7 @@ int Yaz_IR_Assoc::send_searchRequest(Yaz_Z_Query *query, oid_ent_to_oid(&prefsyn, oid_syntax); req->preferredRecordSyntax = oid_syntax; } - logf (m_log, "send_searchRequest"); + yaz_log (m_log, "send_searchRequest"); assert (req->otherInfo == 0); if (m_cookie) { diff --git a/src/yaz-my-server.cpp b/src/yaz-my-server.cpp index 8687a2d..0ec90bd 100644 --- a/src/yaz-my-server.cpp +++ b/src/yaz-my-server.cpp @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: yaz-my-server.cpp,v $ - * Revision 1.6 2001-05-17 14:18:03 adam + * Revision 1.7 2001-08-13 16:39:12 adam + * PDU_Assoc keeps track of children. Using yaz_log instead of logf. + * + * Revision 1.6 2001/05/17 14:18:03 adam * New handler for old version item update for server: * void update_service0 (Z_ExtendedServicesRequest *req, * Z_IU0Update *io, Z_ExtendedServicesResponse *res) @@ -164,7 +167,6 @@ void MyUpdate::update_service0 (Z_ExtendedServicesRequest *req, yaz_log (LOG_LOG, "MyServer::update_service (v1.0)"); } - #if HAVE_YAZ_URSULA_H void MyUrsula::ursula_service (Z_ExtendedServicesRequest *req, Z_UrsPDU *u, @@ -286,7 +288,6 @@ void MyServer::connectNotify() { } - void usage(char *prog) { fprintf (stderr, "%s: [-a log] [-v level] [-T] @:port\n", prog); diff --git a/src/yaz-pdu-assoc-thread.cpp b/src/yaz-pdu-assoc-thread.cpp index 01078d5..d59846c 100644 --- a/src/yaz-pdu-assoc-thread.cpp +++ b/src/yaz-pdu-assoc-thread.cpp @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: yaz-pdu-assoc-thread.cpp,v $ - * Revision 1.2 2001-03-27 14:47:45 adam + * Revision 1.3 2001-08-13 16:39:12 adam + * PDU_Assoc keeps track of children. Using yaz_log instead of logf. + * + * Revision 1.2 2001/03/27 14:47:45 adam * New server facility scheme. * * Revision 1.1 2001/03/26 14:43:49 adam @@ -44,10 +47,10 @@ events(void *p) { Yaz_SocketManager *s = (Yaz_SocketManager *) p; - logf (LOG_LOG, "thread started"); + yaz_log (LOG_LOG, "thread started"); while (s->processEvent() > 0) ; - logf (LOG_LOG, "thread finished"); + yaz_log (LOG_LOG, "thread finished"); #ifdef WIN32 #else return 0; @@ -58,7 +61,11 @@ void Yaz_PDU_AssocThread::childNotify(COMSTACK cs) { Yaz_SocketManager *socket_observable = new Yaz_SocketManager; Yaz_PDU_Assoc *new_observable = new Yaz_PDU_Assoc (socket_observable, cs); - + + new_observable->m_next = m_children; + m_children = new_observable; + new_observable->m_parent = this; + /// Clone PDU Observer new_observable->m_PDU_Observer = m_PDU_Observer->sessionNotify(new_observable, cs_fileno(cs)); diff --git a/src/yaz-pdu-assoc.cpp b/src/yaz-pdu-assoc.cpp index 566f9b0..17dc1b0 100644 --- a/src/yaz-pdu-assoc.cpp +++ b/src/yaz-pdu-assoc.cpp @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: yaz-pdu-assoc.cpp,v $ - * Revision 1.23 2001-03-26 14:43:49 adam + * Revision 1.24 2001-08-13 16:39:12 adam + * PDU_Assoc keeps track of children. Using yaz_log instead of logf. + * + * Revision 1.23 2001/03/26 14:43:49 adam * New threaded PDU association. * * Revision 1.22 2001/01/29 11:18:24 adam @@ -214,7 +217,8 @@ void Yaz_PDU_Assoc::socketNotify(int event) else { m_state = Ready; - m_PDU_Observer->connectNotify(); + if (m_PDU_Observer) + m_PDU_Observer->connectNotify(); flush_PDU(); } } @@ -240,6 +244,8 @@ void Yaz_PDU_Assoc::socketNotify(int event) setup observer for child fileid in pdu-assoc 4. start thread */ + yaz_log (m_log, "new session: parent fd=%d child fd=%d", + cs_fileno(m_cs), cs_fileno(new_line)); childNotify (new_line); } break; @@ -267,13 +273,17 @@ void Yaz_PDU_Assoc::socketNotify(int event) { yaz_log (m_log, "Yaz_PDU_Assoc::Connection closed by peer"); close(); - m_PDU_Observer->failNotify(); // problem here.. + if (m_PDU_Observer) + m_PDU_Observer->failNotify(); // problem here.. return; } // lock it, so we know if recv_PDU deletes it. int destroyed = 0; m_destroyed = &destroyed; + if (!m_PDU_Observer) + return; + m_PDU_Observer->recv_PDU(m_input_buf, res); m_destroyed = 0; if (destroyed) // it really was destroyed, return now. @@ -286,12 +296,12 @@ void Yaz_PDU_Assoc::socketNotify(int event) } break; case Closed: - logf (m_log, "CLOSING state=%d event was %d", m_state, event); + yaz_log (m_log, "CLOSING state=%d event was %d", m_state, event); close(); m_PDU_Observer->failNotify(); break; default: - logf (m_log, "Unknown state=%d event was %d", m_state, event); + yaz_log (m_log, "Unknown state=%d event was %d", m_state, event); close(); m_PDU_Observer->failNotify(); } @@ -299,11 +309,15 @@ void Yaz_PDU_Assoc::socketNotify(int event) void Yaz_PDU_Assoc::close() { + Yaz_PDU_Assoc *ch; + for (ch = m_children; ch; ch = ch->m_next) + ch->close(); + m_socketObservable->deleteObserver(this); m_state = Closed; if (m_cs) { - logf (m_log, "Yaz_PDU_Assoc::close fd=%d", cs_fileno(m_cs)); + yaz_log (m_log, "Yaz_PDU_Assoc::close fd=%d", cs_fileno(m_cs)); cs_close (m_cs); } m_cs = 0; @@ -321,6 +335,7 @@ void Yaz_PDU_Assoc::close() void Yaz_PDU_Assoc::destroy() { close(); + if (m_destroyed) *m_destroyed = 1; Yaz_PDU_Assoc **c; @@ -345,6 +360,7 @@ void Yaz_PDU_Assoc::destroy() here->m_parent = 0; delete here; } + yaz_log (m_log, "Yaz_PDU_Assoc::destroy this=%p", this); } Yaz_PDU_Assoc::PDU_Queue::PDU_Queue(const char *buf, int len) @@ -366,14 +382,14 @@ int Yaz_PDU_Assoc::flush_PDU() if (m_state != Ready && m_state != Writing) { - logf (m_log, "YAZ_PDU_Assoc::flush_PDU, not ready"); + yaz_log (m_log, "YAZ_PDU_Assoc::flush_PDU, not ready"); return 1; } PDU_Queue *q = m_queue_out; if (!q) { m_state = Ready; - logf (m_log, "YAZ_PDU_Assoc::flush_PDU queue empty"); + yaz_log (m_log, "YAZ_PDU_Assoc::flush_PDU queue empty"); m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ| YAZ_SOCKET_OBSERVE_WRITE| YAZ_SOCKET_OBSERVE_EXCEPT); @@ -382,7 +398,7 @@ int Yaz_PDU_Assoc::flush_PDU() r = cs_put (m_cs, q->m_buf, q->m_len); if (r < 0) { - logf (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put failed"); + yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put failed"); close(); m_PDU_Observer->failNotify(); return r; @@ -397,12 +413,12 @@ int Yaz_PDU_Assoc::flush_PDU() mask |= YAZ_SOCKET_OBSERVE_READ; m_socketObservable->maskObserver(this, mask); - logf (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put %d bytes (incomplete)", - q->m_len); + yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put %d bytes (incomp)", + q->m_len); return r; } m_state = Ready; - logf (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put %d bytes", q->m_len); + yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put %d bytes", q->m_len); // whole packet sent... delete this and proceed to next ... m_queue_out = q->m_next; delete q; @@ -415,13 +431,13 @@ int Yaz_PDU_Assoc::flush_PDU() int Yaz_PDU_Assoc::send_PDU(const char *buf, int len) { - logf (m_log, "Yaz_PDU_Assoc::send_PDU"); + yaz_log (m_log, "Yaz_PDU_Assoc::send_PDU"); PDU_Queue **pq = &m_queue_out; int is_idle = (*pq ? 0 : 1); if (!m_cs) { - logf (m_log, "Yaz_PDU_Assoc::send_PDU failed, m_cs == 0"); + yaz_log (m_log, "Yaz_PDU_Assoc::send_PDU failed, m_cs == 0"); return -1; } while (*pq) @@ -430,8 +446,8 @@ int Yaz_PDU_Assoc::send_PDU(const char *buf, int len) if (is_idle) return flush_PDU (); else - logf (m_log, "Yaz_PDU_Assoc::cannot send_PDU fd=%d", - cs_fileno(m_cs)); + yaz_log (m_log, "Yaz_PDU_Assoc::cannot send_PDU fd=%d", + cs_fileno(m_cs)); return 0; } @@ -445,7 +461,7 @@ void Yaz_PDU_Assoc::listen(IYaz_PDU_Observer *observer, { close(); - logf (LOG_LOG, "Adding listener %s", addr); + yaz_log (LOG_LOG, "Adding listener %s", addr); m_PDU_Observer = observer; void *ap; @@ -458,27 +474,28 @@ void Yaz_PDU_Assoc::listen(IYaz_PDU_Observer *observer, m_socketObservable->addObserver(cs_fileno(m_cs), this); m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ| YAZ_SOCKET_OBSERVE_EXCEPT); - logf (m_log, "Yaz_PDU_Assoc::listen ok fd=%d", cs_fileno(m_cs)); + yaz_log (m_log, "Yaz_PDU_Assoc::listen ok fd=%d", cs_fileno(m_cs)); m_state = Listen; } void Yaz_PDU_Assoc::idleTime(int idleTime) { m_idleTime = idleTime; - logf (m_log, "Yaz_PDU_Assoc::idleTime(%d)", idleTime); + yaz_log (m_log, "Yaz_PDU_Assoc::idleTime(%d)", idleTime); m_socketObservable->timeoutObserver(this, m_idleTime); } void Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer, const char *addr) { - logf (m_log, "Yaz_PDU_Assoc::connect %s", addr); + yaz_log (m_log, "Yaz_PDU_Assoc::connect %s", addr); close(); m_PDU_Observer = observer; void *ap; m_cs = comstack(addr, &ap); int res = cs_connect (m_cs, ap); - logf (m_log, "Yaz_PDU_Assoc::connect fd=%d res=%d", cs_fileno(m_cs), res); + yaz_log (m_log, "Yaz_PDU_Assoc::connect fd=%d res=%d", cs_fileno(m_cs), + res); m_socketObservable->addObserver(cs_fileno(m_cs), this); if (res >= 0) @@ -503,9 +520,15 @@ void Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer, // Single-threaded... Only useful for non-blocking handlers void Yaz_PDU_Assoc::childNotify(COMSTACK cs) { + + Yaz_PDU_Assoc *new_observable = new Yaz_PDU_Assoc (m_socketObservable, cs); + new_observable->m_next = m_children; + m_children = new_observable; + new_observable->m_parent = this; + // Clone PDU Observer new_observable->m_PDU_Observer = m_PDU_Observer->sessionNotify (new_observable, cs_fileno(cs)); diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index c463833..d501230 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: yaz-proxy.cpp,v $ - * Revision 1.25 2001-04-25 18:59:30 adam + * Revision 1.26 2001-08-13 16:39:12 adam + * PDU_Assoc keeps track of children. Using yaz_log instead of logf. + * + * Revision 1.25 2001/04/25 18:59:30 adam * Added referenceId handling for server. * * Revision 1.24 2001/04/10 10:48:08 adam @@ -174,13 +177,13 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) get_otherInfoAPDU(apdu, &oi); char *cookie = get_cookie(oi); - logf (LOG_LOG, "Yaz_Proxy::get_client cookie=%s", cookie ? cookie : + yaz_log (LOG_LOG, "Yaz_Proxy::get_client cookie=%s", cookie ? cookie : "null"); const char *proxy_host = get_proxy(oi); if (proxy_host) set_proxyTarget(proxy_host); - logf (LOG_LOG, "proxy_host = %s", m_proxyTarget ? m_proxyTarget:"none"); + yaz_log (LOG_LOG, "proxy_host = %s", m_proxyTarget ? m_proxyTarget:"none"); // no target specified at all? if (!m_proxyTarget) @@ -188,20 +191,20 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) if (cookie && *cookie) { - logf (LOG_LOG, "lookup of clients cookie=%s target=%s", + yaz_log (LOG_LOG, "lookup of clients cookie=%s target=%s", cookie, m_proxyTarget); Yaz_ProxyClient *cc = 0; for (c = parent->m_clientPool; c; c = c->m_next) { - logf (LOG_LOG, " found client cookie = %s target=%s seqno=%d", + yaz_log (LOG_LOG, " found client cookie = %s target=%s seqno=%d", c->m_cookie, c->get_hostname(), c->m_seqno); assert (c->m_prev); assert (*c->m_prev == c); if (!strcmp(cookie,c->m_cookie) && !strcmp(m_proxyTarget, c->get_hostname())) { - logf (LOG_LOG, "found!"); + yaz_log (LOG_LOG, "found!"); cc = c; } } @@ -214,7 +217,7 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) // we have an initRequest we can safely do re-open if (c->m_waiting && apdu->which == Z_APDU_initRequest) { - logf (LOG_LOG, "reopen target=%s", c->get_hostname()); + yaz_log (LOG_LOG, "reopen target=%s", c->get_hostname()); c->close(); c->client(m_proxyTarget); c->m_init_flag = 0; @@ -240,10 +243,10 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) { if (apdu->which != Z_APDU_initRequest) { - logf (LOG_LOG, "no first INIT!"); + yaz_log (LOG_LOG, "no first INIT!"); return 0; } - logf (LOG_LOG, "got InitRequest"); + yaz_log (LOG_LOG, "got InitRequest"); // go through list of clients - and find the lowest/oldest one. Yaz_ProxyClient *c_min = 0; @@ -263,7 +266,7 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) c = c_min; if (c->m_waiting || strcmp(m_proxyTarget, c->get_hostname())) { - logf (LOG_LOG, "Yaz_Proxy::get_client re-init session %d", + yaz_log (LOG_LOG, "Yaz_Proxy::get_client re-init session %d", c->m_seqno); if (c->m_server && c->m_server != this) delete c->m_server; @@ -271,7 +274,8 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) } else { - logf (LOG_LOG, "Yaz_Proxy::get_client re-use session %d to %d", + yaz_log (LOG_LOG, + "Yaz_Proxy::get_client re-use session %d to %d", c->m_seqno, parent->m_seqno); if (cookie) strcpy (c->m_cookie, cookie); @@ -290,7 +294,7 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) } else { - logf (LOG_LOG, "Yaz_Proxy::get_client making session %d", + yaz_log (LOG_LOG, "Yaz_Proxy::get_client making session %d", parent->m_seqno); c = new Yaz_ProxyClient(m_PDU_Observable->clone()); c->m_next = parent->m_clientPool; @@ -303,7 +307,8 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) strcpy (c->m_cookie, cookie); else c->m_cookie[0] = '\0'; - logf (LOG_LOG, "Yaz_Proxy::get_client connect to %s", m_proxyTarget); + yaz_log (LOG_LOG, "Yaz_Proxy::get_client connect to %s", + m_proxyTarget); c->m_seqno = parent->m_seqno; c->client(m_proxyTarget); c->m_init_flag = 0; @@ -338,7 +343,7 @@ Z_APDU *Yaz_Proxy::result_set_optimize(Z_APDU *apdu) m_client->m_last_resultCount < *sr->largeSetLowerBound) { // medium Set - logf (LOG_LOG, "Yaz_Proxy::result_set_optimize medium set"); + yaz_log (LOG_LOG, "Yaz_Proxy::result_set_optimize medium set"); Z_APDU *new_apdu = create_Z_PDU(Z_APDU_presentRequest); Z_PresentRequest *pr = new_apdu->u.presentRequest; pr->referenceId = sr->referenceId; @@ -359,7 +364,7 @@ Z_APDU *Yaz_Proxy::result_set_optimize(Z_APDU *apdu) m_client->m_last_resultCount == 0) { // large set - logf (LOG_LOG, "Yaz_Proxy::result_set_optimize large set"); + yaz_log (LOG_LOG, "Yaz_Proxy::result_set_optimize large set"); Z_APDU *new_apdu = create_Z_PDU(Z_APDU_searchResponse); new_apdu->u.searchResponse->referenceId = sr->referenceId; new_apdu->u.searchResponse->resultCount = @@ -370,7 +375,7 @@ Z_APDU *Yaz_Proxy::result_set_optimize(Z_APDU *apdu) else { // small set - logf (LOG_LOG, "Yaz_Proxy::result_set_optimize small set"); + yaz_log (LOG_LOG, "Yaz_Proxy::result_set_optimize small set"); Z_APDU *new_apdu = create_Z_PDU(Z_APDU_presentRequest); Z_PresentRequest *pr = new_apdu->u.presentRequest; pr->referenceId = sr->referenceId; @@ -390,7 +395,7 @@ Z_APDU *Yaz_Proxy::result_set_optimize(Z_APDU *apdu) } else { - logf (LOG_LOG, "Yaz_Proxy::result_set_optimize new set"); + yaz_log (LOG_LOG, "Yaz_Proxy::result_set_optimize new set"); delete m_client->m_last_query; m_client->m_last_query = this_query; } @@ -399,7 +404,7 @@ Z_APDU *Yaz_Proxy::result_set_optimize(Z_APDU *apdu) void Yaz_Proxy::recv_Z_PDU(Z_APDU *apdu) { - logf (LOG_LOG, "Yaz_Proxy::recv_Z_PDU"); + yaz_log (LOG_LOG, "Yaz_Proxy::recv_Z_PDU"); // Determine our client. m_client = get_client(apdu); if (!m_client) @@ -426,7 +431,8 @@ void Yaz_Proxy::recv_Z_PDU(Z_APDU *apdu) if (!apdu) return; - logf (LOG_LOG, "Yaz_ProxyClient::send_Z_PDU %s", m_client->get_hostname()); + yaz_log (LOG_LOG, "Yaz_ProxyClient::send_Z_PDU %s", + m_client->get_hostname()); // delete other info part from PDU before sending to target Z_OtherInformation **oi; @@ -450,7 +456,7 @@ void Yaz_Proxy::connectNotify() void Yaz_Proxy::shutdown() { - logf (LOG_LOG, "shutdown (client to proxy)"); + yaz_log (LOG_LOG, "shutdown (client to proxy)"); // only keep if keep_alive flag and cookie is set... if (m_keepalive && m_client && m_client->m_cookie[0]) { @@ -475,26 +481,26 @@ void Yaz_Proxy::shutdown() void Yaz_ProxyClient::shutdown() { - logf (LOG_LOG, "shutdown (proxy to server) %s", get_hostname()); + yaz_log (LOG_LOG, "shutdown (proxy to server) %s", get_hostname()); delete m_server; delete this; } void Yaz_Proxy::failNotify() { - logf (LOG_LOG, "connection closed by client"); + yaz_log (LOG_LOG, "connection closed by client"); shutdown(); } void Yaz_ProxyClient::failNotify() { - logf (LOG_LOG, "Yaz_ProxyClient connection closed by %s", get_hostname()); + yaz_log (LOG_LOG, "Yaz_ProxyClient connection closed by %s", get_hostname()); shutdown(); } void Yaz_ProxyClient::connectNotify() { - logf (LOG_LOG, "Yaz_ProxyClient connection accepted by %s", + yaz_log (LOG_LOG, "Yaz_ProxyClient connection accepted by %s", get_hostname()); timeout(600); } @@ -517,13 +523,13 @@ Yaz_ProxyClient::~Yaz_ProxyClient() void Yaz_Proxy::timeoutNotify() { - logf (LOG_LOG, "timeout (client to proxy)"); + yaz_log (LOG_LOG, "timeout (client to proxy)"); shutdown(); } void Yaz_ProxyClient::timeoutNotify() { - logf (LOG_LOG, "timeout (proxy to target) %s", get_hostname()); + yaz_log (LOG_LOG, "timeout (proxy to target) %s", get_hostname()); shutdown(); } @@ -543,7 +549,7 @@ Yaz_ProxyClient::Yaz_ProxyClient(IYaz_PDU_Observable *the_PDU_Observable) : void Yaz_ProxyClient::recv_Z_PDU(Z_APDU *apdu) { m_waiting = 0; - logf (LOG_LOG, "Yaz_ProxyClient::recv_Z_PDU %s", get_hostname()); + yaz_log (LOG_LOG, "Yaz_ProxyClient::recv_Z_PDU %s", get_hostname()); if (apdu->which == Z_APDU_searchResponse) { m_last_resultCount = *apdu->u.searchResponse->resultCount; @@ -573,7 +579,7 @@ void Yaz_ProxyClient::recv_Z_PDU(Z_APDU *apdu) set_otherInformationString (apdu, VAL_COOKIE, 1, m_cookie); if (m_server) { - logf (LOG_LOG, "Yaz_Proxy::send_Z_PDU"); + yaz_log (LOG_LOG, "Yaz_Proxy::send_Z_PDU"); m_server->send_Z_PDU(apdu); } } diff --git a/src/yaz-socket-manager.cpp b/src/yaz-socket-manager.cpp index 669597a..d951926 100644 --- a/src/yaz-socket-manager.cpp +++ b/src/yaz-socket-manager.cpp @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: yaz-socket-manager.cpp,v $ - * Revision 1.15 2001-03-26 14:43:49 adam + * Revision 1.16 2001-08-13 16:39:12 adam + * PDU_Assoc keeps track of children. Using yaz_log instead of logf. + * + * Revision 1.15 2001/03/26 14:43:49 adam * New threaded PDU association. * * Revision 1.14 2000/11/20 14:17:36 adam @@ -146,7 +149,7 @@ int Yaz_SocketManager::processEvent() YazSocketEntry *p; YazSocketEvent *event = getEvent(); unsigned timeout = 0; - logf (m_log, "Yaz_SocketManager::processEvent manager=%p", this); + yaz_log (m_log, "Yaz_SocketManager::processEvent manager=%p", this); if (event) { event->observer->socketNotify(event->event); @@ -202,9 +205,9 @@ int Yaz_SocketManager::processEvent() } if (!no) { - logf (m_log, "no pending events return 0"); + yaz_log (m_log, "no pending events return 0"); if (!m_observers) - logf (m_log, "no observers"); + yaz_log (m_log, "no observers"); return 0; } @@ -212,7 +215,7 @@ int Yaz_SocketManager::processEvent() to.tv_sec = timeout; to.tv_usec = 0; - logf (m_log, "Yaz_SocketManager::select no=%d timeout=%d", no, timeout); + yaz_log (m_log, "Yaz_SocketManager::select no=%d timeout=%d", no, timeout); while ((res = select(max + 1, &in, &out, &except, timeout ? &to : 0)) < 0) if (errno != EINTR) return -1; @@ -242,7 +245,7 @@ int Yaz_SocketManager::processEvent() now >= p->last_activity + (int) (p->timeout)) { YazSocketEvent *event = new YazSocketEvent; - logf (m_log, "timeout, now = %ld last_activity=%ld timeout=%d", + yaz_log (m_log, "timeout, now = %ld last_activity=%ld timeout=%d", now, p->last_activity, p->timeout); p->last_activity = now; event->observer = p->observer; diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index 8782136..e9f4b19 100644 --- a/src/yaz-z-assoc.cpp +++ b/src/yaz-z-assoc.cpp @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: yaz-z-assoc.cpp,v $ - * Revision 1.20 2001-04-25 18:59:30 adam + * Revision 1.21 2001-08-13 16:39:12 adam + * PDU_Assoc keeps track of children. Using yaz_log instead of logf. + * + * Revision 1.20 2001/04/25 18:59:30 adam * Added referenceId handling for server. * * Revision 1.19 2001/03/27 14:47:45 adam @@ -144,7 +147,7 @@ Yaz_Z_Assoc::~Yaz_Z_Assoc() void Yaz_Z_Assoc::recv_PDU(const char *buf, int len) { - logf (m_log, "recv_PDU len=%d", len); + yaz_log (m_log, "recv_PDU len=%d", len); Z_APDU *apdu = decode_Z_PDU (buf, len); if (apdu) { @@ -257,10 +260,10 @@ Z_APDU *Yaz_Z_Assoc::decode_Z_PDU(const char *buf, int len) if (!z_APDU(m_odr_in, &apdu, 0, 0)) { - logf(LOG_LOG, "ODR error on incoming PDU: %s [near byte %d] ", + yaz_log(LOG_LOG, "ODR error on incoming PDU: %s [near byte %d] ", odr_errmsg(odr_geterror(m_odr_in)), odr_offset(m_odr_in)); - logf(LOG_LOG, "PDU dump:"); + yaz_log(LOG_LOG, "PDU dump:"); odr_dumpBER(yaz_log_file(), buf, len); return 0; } @@ -278,7 +281,7 @@ int Yaz_Z_Assoc::encode_Z_PDU(Z_APDU *apdu, char **buf, int *len) z_APDU(m_odr_print, &apdu, 0, "encode"); if (!z_APDU(m_odr_out, &apdu, 0, 0)) { - logf (LOG_LOG, "yaz_Z_Assoc::encode_Z_PDU failed"); + yaz_log (LOG_LOG, "yaz_Z_Assoc::encode_Z_PDU failed"); return -1; } *buf = odr_getbuf (m_odr_out, len, 0); diff --git a/src/yaz-z-server-ursula.cpp b/src/yaz-z-server-ursula.cpp index 0bf2ca8..5476c85 100644 --- a/src/yaz-z-server-ursula.cpp +++ b/src/yaz-z-server-ursula.cpp @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: yaz-z-server-ursula.cpp,v $ - * Revision 1.4 2001-04-25 19:40:18 adam + * Revision 1.5 2001-08-13 16:39:12 adam + * PDU_Assoc keeps track of children. Using yaz_log instead of logf. + * + * Revision 1.4 2001/04/25 19:40:18 adam * Added refernceId handling for other services. * * Revision 1.3 2001/04/11 12:33:42 heikki @@ -47,7 +50,7 @@ int Yaz_Facility_Ursula::recv(Yaz_Z_Server *s, Z_APDU *apdu_request) if (r->which != ODR_EXTERNAL_octet) { - logf (LOG_LOG, "ursula::recv not octet alighed"); + yaz_log (LOG_LOG, "ursula::recv not octet alighed"); return 0; } odr_setbuf (s->odr_decode(), (char*) r->u.octet_aligned->buf, @@ -55,7 +58,7 @@ int Yaz_Facility_Ursula::recv(Yaz_Z_Server *s, Z_APDU *apdu_request) Z_UrsPDU *pdu = 0; if (!z_UrsPDU (s->odr_decode(), &pdu, 0, "")) { - logf (LOG_LOG, "ursula::decode failed"); + yaz_log (LOG_LOG, "ursula::decode failed"); return 0; } yaz_log (LOG_LOG, "got ursula packet");