X-Git-Url: http://git.indexdata.com/?p=yazproxy-moved-to-github.git;a=blobdiff_plain;f=src%2Ft-server.cpp;h=2599e2ebb8f628796f358d2891d8707ad6585300;hp=a264ddf632e1a05856ceb2108253adb7f035d415;hb=4f79f9b5b0095b2f81b1ce583f0f82462f9ee36a;hpb=7247137cb7c4aca0a67cfd2f0f814067c2bec4c8 diff --git a/src/t-server.cpp b/src/t-server.cpp index a264ddf..2599e2e 100644 --- a/src/t-server.cpp +++ b/src/t-server.cpp @@ -1,9 +1,20 @@ -/* - * Copyright (c) 1998-2005, Index Data. - * See the file LICENSE for details. - * - * $Id: t-server.cpp,v 1.5 2005-09-26 09:24:14 adam Exp $ - */ +/* This file is part of YAZ proxy + Copyright (C) 1998-2011 Index Data + +YAZ proxy is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +YAZ proxy is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #include #include @@ -11,10 +22,15 @@ #include #include #include "msg-thread.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include + +#if HAVE_UNISTD_H +#include +#endif using namespace yazpp_1; @@ -45,7 +61,7 @@ Auth_Msg::~Auth_Msg() delete m_output; delete m_gdu; } - + IMsg_Thread *Auth_Msg::handle() { ODR odr = odr_createmem(ODR_ENCODE); @@ -63,7 +79,9 @@ IMsg_Thread *Auth_Msg::handle() ODR_MASK_SET(apdu->u.initResponse->options, Z_Options_present); break; case Z_APDU_searchRequest: +#if HAVE_UNISTD_H sleep(5); +#endif apdu = zget_APDU(odr, Z_APDU_searchResponse); break; case Z_APDU_triggerResourceControlRequest: @@ -153,7 +171,7 @@ void MyServer::recv_GDU(Z_GDU *apdu, int len) GDU *gdu = new GDU(apdu); Auth_Msg *m = new Auth_Msg(gdu, this); m_no_requests++; - m_my_thread->put(m); + m_my_thread->put(m); } void MyServer::failNotify() @@ -161,7 +179,7 @@ void MyServer::failNotify() m_delete_flag = 1; if (m_no_requests == 0) delete this; - + } void MyServer::timeoutNotify() @@ -220,7 +238,7 @@ int main(int argc, char **argv) SocketManager mySocketManager; PDU_Assoc *my_PDU_Assoc = 0; - + MyServer *z = 0; Msg_Thread *my_thread = new Msg_Thread(&mySocketManager, no_threads); @@ -233,7 +251,7 @@ int main(int argc, char **argv) #else my_PDU_Assoc = new PDU_Assoc(&mySocketManager); #endif - + z = new MyServer(my_PDU_Assoc, my_thread); z->server(addr); if (apdu_log) @@ -246,11 +264,12 @@ int main(int argc, char **argv) ; delete z; delete my_thread; - return 0; + return 0; } /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab