X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fyaz-server.cpp;h=8aecb147122c33ea842e2f488e63d4b29ee22f6b;hb=316df82985a4207a7d52e7d88567bf26d5c2c7c8;hp=2d2c244a43cb82997e67a2cc2f570d3c35edce18;hpb=c6e5ad789740135af3558298f6e2014ae99ee7dd;p=yazpp-moved-to-github.git diff --git a/src/yaz-server.cpp b/src/yaz-server.cpp index 2d2c244..8aecb14 100644 --- a/src/yaz-server.cpp +++ b/src/yaz-server.cpp @@ -1,10 +1,20 @@ /* - * Copyright (c) 1998-1999, Index Data. + * Copyright (c) 1998-2000, Index Data. * See the file LICENSE for details. - * Sebastian Hammer, Adam Dickmeiss * * $Log: yaz-server.cpp,v $ - * Revision 1.5 1999-04-09 11:46:57 adam + * Revision 1.8 2000-09-08 10:23:42 adam + * Added skeleton of yaz-z-server. + * + * Revision 1.7 1999/12/06 13:52:45 adam + * Modified for new location of YAZ header files. Experimental threaded + * operation. + * + * Revision 1.6 1999/04/21 12:09:01 adam + * Many improvements. Modified to proxy server to work with "sessions" + * based on cookies. + * + * Revision 1.5 1999/04/09 11:46:57 adam * Added object Yaz_Z_Assoc. Much more functional client. * * Revision 1.4 1999/03/23 14:17:57 adam @@ -22,18 +32,19 @@ * */ -#include -#include +#include +#include #include #include -class MyServer : public Yaz_Z_Assoc { +class MyServer : public Yaz_Z_Server { public: MyServer(IYaz_PDU_Observable *the_PDU_Observable); void recv_Z_PDU(Z_APDU *apdu); IYaz_PDU_Observer* clone(IYaz_PDU_Observable *the_PDU_Observable); void failNotify(); void timeoutNotify(); + void connectNotify(); private: int m_no; }; @@ -59,20 +70,23 @@ void MyServer::recv_Z_PDU(Z_APDU *apdu) logf (LOG_LOG, "got presentRequest"); apdu = create_Z_PDU(Z_APDU_presentResponse); send_Z_PDU(apdu); - stop = 1; + // stop = 1; break; } } IYaz_PDU_Observer *MyServer::clone(IYaz_PDU_Observable *the_PDU_Observable) { + MyServer *new_server; logf (LOG_LOG, "child no %d", m_no); m_no++; - return new MyServer(the_PDU_Observable); + new_server = new MyServer(the_PDU_Observable); + new_server->timeout(60); + return new_server; } MyServer::MyServer(IYaz_PDU_Observable *the_PDU_Observable) : - Yaz_Z_Assoc (the_PDU_Observable) + Yaz_Z_Server (the_PDU_Observable) { m_no = 0; } @@ -89,14 +103,17 @@ void MyServer::failNotify() delete this; } +void MyServer::connectNotify() +{ +} + int main(int argc, char **argv) { Yaz_SocketManager mySocketManager; - Yaz_PDU_Assoc *my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager, 0); + Yaz_PDU_Assoc *my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager); - my_PDU_Assoc->idleTime(20); MyServer z(my_PDU_Assoc); - + if (argc <= 1) z.server("@:9999"); else