* Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
* Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
-class Mutex {
-public:
- Mutex();
- ~Mutex();
- void lock();
- void unlock();
-private:
- pthread_mutex_t m_mutex;
-
-};
-
-Mutex::Mutex()
-{
- pthread_mutex_init(&m_mutex, 0);
-}
-
-Mutex::~Mutex()
-{
- pthread_mutex_destroy(&m_mutex);
-}
-
-void Mutex::lock()
-{
- pthread_mutex_lock(&m_mutex);
-}
-
-void Mutex::unlock()
-{
- pthread_mutex_unlock(&m_mutex);
-}
-
-
- Z_APDU *apdu = 0;
- switch(z_gdu->u.z3950->which)
- {
- case Z_APDU_initRequest:
- apdu = zget_APDU(odr, Z_APDU_initResponse);
- break;
- case Z_APDU_searchRequest:
- sleep(5);
- apdu = zget_APDU(odr, Z_APDU_searchResponse);
- break;
- default:
- apdu = zget_APDU(odr, Z_APDU_close);
- m_close_flag = 1;
- break;
- }
- if (apdu)
- m_output = new GDU(apdu);
+ Z_APDU *apdu = 0;
+ switch(z_gdu->u.z3950->which)
+ {
+ case Z_APDU_initRequest:
+ apdu = zget_APDU(odr, Z_APDU_initResponse);
+ break;
+ case Z_APDU_searchRequest:
+ sleep(5);
+ apdu = zget_APDU(odr, Z_APDU_searchResponse);
+ break;
+ default:
+ apdu = zget_APDU(odr, Z_APDU_close);
+ m_close_flag = 1;
+ break;
+ }
+ if (apdu)
+ m_output = new GDU(apdu);
- if (m_output)
- {
- int len;
- m_front->send_GDU(m_output->get(), &len);
- }
- if (m_close_flag)
- {
- m_front->close();
- m_front->m_delete_flag = 1;
- }
+ if (m_output)
+ {
+ int len;
+ m_front->send_GDU(m_output->get(), &len);
+ }
+ if (m_close_flag)
+ {
+ m_front->close();
+ m_front->m_delete_flag = 1;
+ }
{
MyServer *my = new MyServer(the_PDU_Observable, m_my_thread);
yaz_log(YLOG_LOG, "New session %s", the_PDU_Observable->getpeername());
{
MyServer *my = new MyServer(the_PDU_Observable, m_my_thread);
yaz_log(YLOG_LOG, "New session %s", the_PDU_Observable->getpeername());
- while ((ret = options("a:v:T", argv, argc, &arg)) != -2)
+ while ((ret = options("n:a:v:T", argv, argc, &arg)) != -2)
- switch (ret)
- {
- case 0:
- addr = xstrdup(arg);
- break;
- case 'a':
- apdu_log = xstrdup(arg);
- break;
- case 'v':
- yaz_log_init_level (yaz_log_mask_str(arg));
- break;
- case 'T':
- thread_flag = 1;
- break;
- default:
- usage(prog);
- return 1;
- }
+ switch (ret)
+ {
+ case 0:
+ addr = xstrdup(arg);
+ break;
+ case 'n':
+ no_threads = atoi(arg);
+ break;
+ case 'a':
+ apdu_log = xstrdup(arg);
+ break;
+ case 'v':
+ yaz_log_init_level (yaz_log_mask_str(arg));
+ break;
+ case 'T':
+ thread_flag = 1;
+ break;
+ default:
+ usage(prog);
+ return 1;
+ }
- yaz_log (YLOG_LOG, "set_APDU_log %s", apdu_log);
- z->set_APDU_log(apdu_log);
+ yaz_log (YLOG_LOG, "set_APDU_log %s", apdu_log);
+ z->set_APDU_log(apdu_log);