summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/Concurrency.cpp28
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/IO.cpp6
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/Makefile2
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp11
-rw-r--r--apps/JAWS/PROTOTYPE/JAWS/Waiter.cpp19
5 files changed, 43 insertions, 23 deletions
diff --git a/apps/JAWS/PROTOTYPE/JAWS/Concurrency.cpp b/apps/JAWS/PROTOTYPE/JAWS/Concurrency.cpp
index 3f1d589ce32..26670687799 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/Concurrency.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/Concurrency.cpp
@@ -154,8 +154,9 @@ JAWS_Concurrency_Base::svc_hook (JAWS_Data_Block *ts_db)
// the task should set the handler to the appropriate next step
result = task->put (mb);
- if (result == 0)
+ if (result == 0 || result == -3)
handler = mb->io_handler ();
+ else handler = 0;
if (result == 1 || result == 2)
{
@@ -165,19 +166,31 @@ JAWS_Concurrency_Base::svc_hook (JAWS_Data_Block *ts_db)
// We need a way to destroy all the handlers created by the
// Asynch_Acceptor. Figure this out later.
handler = waiter->wait_for_completion (waiter_index);
- result = (handler == 0) ? -1 : 0;
+ if (handler == 0)
+ {
+ JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, bad proactor");
+ // Proactor failed
+ result = -1;
+ break;
+ }
}
if (result < 0)
{
- // something wrong.
JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, negative result");
- ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Concurrency_Base::svc_hook"));
- if (result > -2 && handler)
+ if (result == -1)
+ ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Concurrency_Base::svc_hook"));
+
+ if (handler)
handler->done ();
+
handler = 0;
- JAWS_IO_Handler **ioh = waiter->find (waiter_index);
- *ioh = 0;
+ if (result == -2)
+ {
+ JAWS_IO_Handler **ioh = waiter->find (waiter_index);
+ *ioh = 0;
+ result = 0;
+ }
break;
}
@@ -186,6 +199,7 @@ JAWS_Concurrency_Base::svc_hook (JAWS_Data_Block *ts_db)
mb = handler->message_block ();
task = handler->task ();
+ result = 0;
}
while (result == 0);
diff --git a/apps/JAWS/PROTOTYPE/JAWS/IO.cpp b/apps/JAWS/PROTOTYPE/JAWS/IO.cpp
index 9c672e18c55..4ba2174bbf7 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/IO.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/IO.cpp
@@ -280,6 +280,8 @@ JAWS_Asynch_IO::receive_file (JAWS_IO_Handler *ioh,
unsigned int initial_data_length,
unsigned int entire_length)
{
+ JAWS_TRACE ("JAWS_Asynch_IO::receive_file");
+
ioh->idle ();
JAWS_Asynch_IO_Handler *aioh =
@@ -334,6 +336,8 @@ JAWS_Asynch_IO::transmit_file (JAWS_IO_Handler *ioh,
const char *trailer,
unsigned int trailer_size)
{
+ JAWS_TRACE ("JAWS_Asynch_IO::transmit_file");
+
ioh->idle ();
JAWS_Asynch_IO_Handler *aioh =
@@ -350,7 +354,7 @@ JAWS_Asynch_IO::transmit_file (JAWS_IO_Handler *ioh,
ACE_Message_Block trailer_mb (trailer, trailer_size);
header_and_trailer = new ACE_Asynch_Transmit_File::Header_And_Trailer
- (&header_mb, header_size, &trailer_mb, trailer_size);
+ (header_mb.duplicate (), header_size, trailer_mb.duplicate (), trailer_size);
ACE_Asynch_Transmit_File tf;
diff --git a/apps/JAWS/PROTOTYPE/JAWS/Makefile b/apps/JAWS/PROTOTYPE/JAWS/Makefile
index b4415b55f89..211a853deb1 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/Makefile
+++ b/apps/JAWS/PROTOTYPE/JAWS/Makefile
@@ -31,7 +31,7 @@ MYFILES = \
LSRC = $(addsuffix .cpp,$(MYFILES))
LOBJ = $(addsuffix .o,$(MYFILES))
-CPPFLAGS += -I.. -DJAWS_NTRACE=1 -DACE_NLOGGING -DJAWS_HAS_THREAD_SAFE_ACCEPT
+CPPFLAGS += -I.. -DJAWS_NTRACE=0 -DACE_NLOGGING -DJAWS_HAS_THREAD_SAFE_ACCEPT
VLDLIBS = $(LDLIBS:%=%$(VAR))
diff --git a/apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp b/apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp
index 7197b945786..fa3a57faac0 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/Pipeline_Tasks.cpp
@@ -23,22 +23,23 @@ int
JAWS_Pipeline_Handler::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
{
JAWS_Data_Block *db = ACE_dynamic_cast (JAWS_Data_Block *, mb);
+ JAWS_IO_Handler *ioh = db->io_handler ();
// guarantee the handler remains for the duration of this call
- db->io_handler ()->acquire ();
+ ioh->acquire ();
int status = this->handle_put (db, tv);
if (status != -1 && status != 2)
{
- JAWS_Pipeline_Handler *task = db->io_handler ()->task ();
+ JAWS_Pipeline_Handler *task = ioh->task ();
JAWS_Pipeline_Handler *next
= ACE_dynamic_cast (JAWS_Pipeline_Handler *, task->next ());
- db->io_handler ()->task (next);
+ ioh->task (next);
}
- db->io_handler ()->release ();
+ ioh->release ();
return status;
}
@@ -174,7 +175,7 @@ JAWS_Pipeline_Accept_Task::new_handler (JAWS_Data_Block *data)
int
JAWS_Pipeline_Done_Task::put (ACE_Message_Block *mb, ACE_Time_Value *)
{
- JAWS_TRACE ("JAWS_HTTP_10_Write_Task::handle_put");
+ JAWS_TRACE ("JAWS_Pipeline_Done_Task::put");
JAWS_Data_Block *data = ACE_dynamic_cast (JAWS_Data_Block *, mb);
diff --git a/apps/JAWS/PROTOTYPE/JAWS/Waiter.cpp b/apps/JAWS/PROTOTYPE/JAWS/Waiter.cpp
index c20a0625225..8b47274ac8f 100644
--- a/apps/JAWS/PROTOTYPE/JAWS/Waiter.cpp
+++ b/apps/JAWS/PROTOTYPE/JAWS/Waiter.cpp
@@ -42,22 +42,23 @@ JAWS_Waiter::index (void)
JAWS_IO_Handler *
JAWS_Waiter::wait_for_completion (int i)
{
-loop:
- if (ACE_Proactor::instance ()->handle_events () == -1)
- {
- ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Waiter::wait_for_completion"));
- return 0;
- }
-
JAWS_IO_Handler *ioh;
JAWS_IO_Handler **iohptr;
iohptr = (i >= 0) ? this->find (i) : this->find (this->index ());
- ioh = *iohptr;
+ while (*iohptr == 0)
+ if (ACE_Proactor::instance ()->handle_events () == -1)
+ {
+ ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Waiter::wait_for_completion"));
+ return 0;
+ }
+
+ ioh = *iohptr;
*iohptr = 0;
- if (ioh == 0) goto loop;
+ ioh->lock ();
+ ioh->release ();
return ioh;
}