* Copyright (c) 1998-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: pdu-assoc.h,v 1.2 2003-10-01 13:13:51 adam Exp $
+ * $Id: pdu-assoc.h,v 1.3 2003-10-10 12:37:26 adam Exp $
*/
#ifndef YAZ_PDU_ASSOC_INCLUDED
/// Send PDU
int send_PDU(const char *buf, int len);
/// connect to server (client role)
- void connect(IYaz_PDU_Observer *observer, const char *addr);
+ int connect(IYaz_PDU_Observer *observer, const char *addr);
/// listen for clients (server role)
void listen(IYaz_PDU_Observer *observer, const char *addr);
/// Socket notification
* Copyright (c) 1998-2000, Index Data.
* See the file LICENSE for details.
*
- * $Id: pdu-observer.h,v 1.2 2003-10-01 13:13:51 adam Exp $
+ * $Id: pdu-observer.h,v 1.3 2003-10-10 12:37:26 adam Exp $
*/
#ifndef YAZ_PDU_OBSERVER_H
/// Send encoded PDU buffer of specified length
virtual int send_PDU(const char *buf, int len) = 0;
/// Connect with server specified by addr.
- virtual void connect(IYaz_PDU_Observer *observer, const char *addr) = 0;
+ virtual int connect(IYaz_PDU_Observer *observer, const char *addr) = 0;
/// Listen on address addr.
virtual void listen(IYaz_PDU_Observer *observer, const char *addr) = 0;
/// Close connection
* Copyright (c) 1998-2000, Index Data.
* See the file LICENSE for details.
*
- * $Id: z-assoc.h,v 1.2 2003-10-01 13:13:51 adam Exp $
+ * $Id: z-assoc.h,v 1.3 2003-10-10 12:37:26 adam Exp $
*/
#ifndef YAZ_Z_ASSOC_INCLUDED
/// Timeout specify
void timeout(int timeout);
/// Begin Z39.50 client role
- void client(const char *addr);
+ int client(const char *addr);
/// Begin Z39.50 server role
void server(const char *addr);
/// Close connection
* Copyright (c) 1998-2001, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-pdu-assoc.cpp,v 1.32 2003-10-10 10:50:37 adam Exp $
+ * $Id: yaz-pdu-assoc.cpp,v 1.33 2003-10-10 12:37:26 adam Exp $
*/
#include <assert.h>
m_socketObservable->timeoutObserver(this, m_idleTime);
}
-void Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer,
+int Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer,
const char *addr)
{
yaz_log (m_log, "Yaz_PDU_Assoc::connect %s", addr);
void *ap;
m_cs = comstack(addr, &ap);
if (!m_cs)
- {
- m_PDU_Observer->failNotify();
- return;
- }
+ return -1;
int res = cs_connect (m_cs, ap);
yaz_log (m_log, "Yaz_PDU_Assoc::connect fd=%d res=%d", cs_fileno(m_cs),
res);
m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_WRITE|
YAZ_SOCKET_OBSERVE_EXCEPT);
}
+ return 0;
}
// Single-threaded... Only useful for non-blocking handlers
* Copyright (c) 1998-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-proxy.cpp,v 1.54 2003-10-09 12:11:10 adam Exp $
+ * $Id: yaz-proxy.cpp,v 1.55 2003-10-10 12:37:26 adam Exp $
*/
#include <assert.h>
yaz_log (LOG_LOG, "%s REOPEN target=%s", m_session_str,
c->get_hostname());
c->close();
- c->client(m_proxyTarget);
c->m_init_flag = 0;
c->m_last_ok = 0;
c->m_sr_transform = 0;
c->m_waiting = 0;
c->m_resultSetStartPoint = 0;
+ if (c->client(m_proxyTarget))
+ {
+ delete c;
+ return 0;
+ }
c->timeout(m_target_idletime);
}
c->m_seqno = parent->m_seqno;
c->m_cookie = xstrdup(cookie);
c->m_seqno = parent->m_seqno;
- c->client(m_proxyTarget);
c->m_init_flag = 0;
c->m_last_resultCount = 0;
c->m_last_ok = 0;
c->m_sr_transform = 0;
c->m_waiting = 0;
c->m_resultSetStartPoint = 0;
+ (parent->m_seqno)++;
+ if (c->client(m_proxyTarget))
+ {
+ delete c;
+ return 0;
+ }
c->timeout(30);
- (parent->m_seqno)++;
}
yaz_log (LOG_DEBUG, "get_client 3 %p %p", this, c);
return c;
* Copyright (c) 1998-2001, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-assoc.cpp,v 1.26 2003-10-01 13:13:51 adam Exp $
+ * $Id: yaz-z-assoc.cpp,v 1.27 2003-10-10 12:37:26 adam Exp $
*/
#include <assert.h>
return m_hostname;
}
-void Yaz_Z_Assoc::client(const char *addr)
+int Yaz_Z_Assoc::client(const char *addr)
{
delete [] m_hostname;
m_hostname = new char[strlen(addr)+1];
strcpy (m_hostname, addr);
- m_PDU_Observable->connect (this, addr);
+ return m_PDU_Observable->connect (this, addr);
}
void Yaz_Z_Assoc::close()