X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fyaz-pdu-assoc.cpp;h=b94213e919d20c843fa7921c074e0c38030b198d;hb=1d58071894904fae50f6c577963dbfd4c9b83062;hp=8f0d383ca977951da01ac62c004f893ded8e0220;hpb=b6131942246f587188208dd9df6f5332839101d2;p=yazpp-moved-to-github.git diff --git a/src/yaz-pdu-assoc.cpp b/src/yaz-pdu-assoc.cpp index 8f0d383..b94213e 100644 --- a/src/yaz-pdu-assoc.cpp +++ b/src/yaz-pdu-assoc.cpp @@ -1,8 +1,11 @@ /* This file is part of the yazpp toolkit. - * Copyright (C) 1998-2010 Index Data and Mike Taylor + * Copyright (C) 1998-2012 Index Data and Mike Taylor * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include @@ -419,6 +422,29 @@ COMSTACK PDU_Assoc::comstack(const char *type_and_host, void **vp) int PDU_Assoc::listen(IPDU_Observer *observer, const char *addr) { + if (*addr == '\0') + { + m_socketObservable->deleteObserver(this); + m_state = Closed; + if (m_cs) + { + yaz_log (m_log, "PDU_Assoc::close fd=%d", cs_fileno(m_cs)); + cs_close (m_cs); + } + m_cs = 0; + while (m_queue_out) + { + PDU_Queue *q_this = m_queue_out; + m_queue_out = m_queue_out->m_next; + delete q_this; + } + xfree (m_input_buf); + m_input_buf = 0; + m_input_len = 0; + + return 0; + } + shutdown(); m_PDU_Observer = observer;