summaryrefslogtreecommitdiff
path: root/apps/JAWS/PROTOTYPE
diff options
context:
space:
mode:
authorjxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-08 21:14:38 +0000
committerjxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-08 21:14:38 +0000
commitf91fa3da819031e128397a943201d86bd61ce656 (patch)
tree98b7db4f0d38fb0767cc32ddb80a9c433bdfec89 /apps/JAWS/PROTOTYPE
parentcd64181e88fb42b1822b2eb27b750fd2ef61a8cf (diff)
downloadATCD-f91fa3da819031e128397a943201d86bd61ce656.tar.gz
Fixes with regards to purify, program shutdown and Asynch_Acceptor
initialization.
Diffstat (limited to 'apps/JAWS/PROTOTYPE')
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.cpp27
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.h11
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/IO_Handler.cpp2
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/IO_Handler.h2
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp23
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/Reaper.cpp3
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/Server.cpp15
7 files changed, 58 insertions, 25 deletions
diff --git a/apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.cpp b/apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.cpp
index 0ed9eadfebe..32eb4a6b485 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.cpp
@@ -25,6 +25,11 @@ JAWS_IO_Acceptor::open (const ACE_HANDLE &)
return -1;
}
+void
+JAWS_IO_Acceptor::close (void)
+{
+}
+
int
JAWS_IO_Acceptor::accept (ACE_SOCK_Stream &, ACE_Addr *, ACE_Time_Value *,
int, int) const
@@ -88,6 +93,19 @@ JAWS_IO_Synch_Acceptor::get_handle (void)
}
+
+JAWS_IO_Asynch_Acceptor::JAWS_IO_Asynch_Acceptor (void)
+ : acceptor_ (*(new ACE_Asynch_Acceptor<JAWS_Asynch_Handler>)),
+ acceptor_ptr_ (&acceptor_)
+{
+}
+
+JAWS_IO_Asynch_Acceptor::~JAWS_IO_Asynch_Acceptor (void)
+{
+ delete this->acceptor_ptr_;
+ this->acceptor_ptr_ = 0;
+}
+
int
JAWS_IO_Asynch_Acceptor::open (const ACE_INET_Addr &address, int backlog)
{
@@ -159,6 +177,15 @@ JAWS_IO_Asynch_Acceptor::get_handle (void)
}
+void
+JAWS_IO_Asynch_Acceptor::close (void)
+{
+#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
+ delete this->acceptor_ptr_;
+ this->acceptor_ptr_ = 0;
+#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
+}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Asynch_Acceptor<JAWS_Asynch_Handler>;
diff --git a/apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.h b/apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.h
index d61cb9324e1..c0ef3c321ea 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.h
+++ b/apps/JAWS/PROTOTYPE/JAWS/IO_Acceptor.h
@@ -51,6 +51,9 @@ public:
virtual ACE_HANDLE get_handle (void);
// Get the listener's handle
+ virtual void close (void);
+ // Close the acceptor.
+
enum { ASYNC = 0, SYNCH = 1 };
// identify if this is being used for asynchronous or synchronous
// accept calls
@@ -89,6 +92,9 @@ class JAWS_Export JAWS_IO_Asynch_Acceptor : public JAWS_IO_Acceptor
{
public:
+ JAWS_IO_Asynch_Acceptor (void);
+ virtual ~JAWS_IO_Asynch_Acceptor (void);
+
virtual int open (const ACE_INET_Addr &address, int backlog = 5);
// Initiate an asynchronous passive connection
@@ -101,6 +107,8 @@ public:
virtual ACE_HANDLE get_handle (void);
// Get the listener's handle
+ virtual void close (void);
+
private:
virtual int accept (ACE_SOCK_Stream &new_stream,
@@ -111,7 +119,8 @@ private:
private:
#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- ACE_Asynch_Acceptor<JAWS_Asynch_Handler> acceptor_;
+ ACE_Asynch_Acceptor<JAWS_Asynch_Handler> &acceptor_;
+ ACE_Asynch_Acceptor<JAWS_Asynch_Handler> *acceptor_ptr_;
ACE_HANDLE handle_;
#endif /* defined (ACE_WIN32) */
};
diff --git a/apps/JAWS/PROTOTYPE/JAWS/IO_Handler.cpp b/apps/JAWS/PROTOTYPE/JAWS/IO_Handler.cpp
index 041507c1100..ebcaf0d419a 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/IO_Handler.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/IO_Handler.cpp
@@ -265,11 +265,13 @@ JAWS_Asynch_Handler::act (const void *act_ref)
this->ioh_ = (JAWS_IO_Handler *) act_ref;
}
+#if 0
ACE_HANDLE
JAWS_Asynch_Handler::handle (void) const
{
return this->ioh_->handle ();
}
+#endif
void
JAWS_Asynch_Handler::dispatch_handler (void)
diff --git a/apps/JAWS/PROTOTYPE/JAWS/IO_Handler.h b/apps/JAWS/PROTOTYPE/JAWS/IO_Handler.h
index 3cb060bca34..f27fad98460 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/IO_Handler.h
+++ b/apps/JAWS/PROTOTYPE/JAWS/IO_Handler.h
@@ -164,7 +164,7 @@ public:
virtual void act (const void *act_ref);
// Receives the ACT.
- virtual ACE_HANDLE handle (void) const;
+ //virtual ACE_HANDLE handle (void) const;
private:
JAWS_IO_Handler *ioh_;
diff --git a/apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp b/apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp
index 7b3cd77d32d..b1e28f1cf92 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp
@@ -117,29 +117,6 @@ JAWS_Pipeline_Accept_Task::handle_put (JAWS_Data_Block *data,
JAWS_TRACE ("JAWS_Pipeline_Accept_Task::handle_put ACCEPT_IDLE");
// Should mean that the IO is asynchronous, and the word isn't out
// yet.
-
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- if (policy->ratio () > 1)
- {
- while (policy->ratio () > 1)
- {
- JAWS_IO_Handler *ioh = this->new_handler (data);
- if (handler == 0)
- break;
- ioh->task (handler->task ());
- io->accept (ioh);
- if (ioh->status () == JAWS_IO_Handler::ACCEPT_ERROR)
- {
- ioh->message_block ()->release ();
- ioh->factory ()->destroy_io_handler (ioh);
- break;
- }
- int i = policy->ratio () - 1;
- policy->ratio (i);
- }
- }
-#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
-
break;
}
}
diff --git a/apps/JAWS/PROTOTYPE/JAWS/Reaper.cpp b/apps/JAWS/PROTOTYPE/JAWS/Reaper.cpp
index 98fd87109fd..6d1d5845cba 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/Reaper.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/Reaper.cpp
@@ -2,6 +2,7 @@
#include "JAWS/Reaper.h"
#include "JAWS/Concurrency.h"
+#include "JAWS/IO_Acceptor.h"
ACE_RCSID(JAWS, Reaper, "$Id$")
@@ -37,6 +38,8 @@ JAWS_Reaper::svc (void)
{
ACE_TRACE ("JAWS_Reaper::svc");
int result = this->concurrency_->thr_mgr ()->wait ();
+ JAWS_IO_Synch_Acceptor_Singleton::instance ()->close ();
+ JAWS_IO_Asynch_Acceptor_Singleton::instance ()->close ();
ACE_DEBUG ((LM_DEBUG, "(%t) Leaving REAPER\n"));
return result;
}
diff --git a/apps/JAWS/PROTOTYPE/JAWS/Server.cpp b/apps/JAWS/PROTOTYPE/JAWS/Server.cpp
index 8b4eb8d0699..0b9dfa0c501 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/Server.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/Server.cpp
@@ -107,6 +107,21 @@ JAWS_Server::open (JAWS_Pipeline_Handler *protocol,
db->task ()->next (protocol);
+ // prime the acceptor if appropriate
+ if (this->dispatch_ == 1)
+ {
+#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
+
+ int n = this->nthreads_;
+ if (this->concurrency_ == 1)
+ n = 1;
+
+ for (int i = 0; i < n * this->ratio_ - n; i++)
+ db->task ()->put (db);
+
+#endif /* defined (ACE_WIN32) */
+ }
+
// The message block should contain an INET_Addr, and call the
// io->accept (INET_Addr) method!