summaryrefslogtreecommitdiff
path: root/examples/Reactor
diff options
context:
space:
mode:
Diffstat (limited to 'examples/Reactor')
-rw-r--r--examples/Reactor/Misc/signal_tester.cpp221
-rw-r--r--examples/Reactor/Misc/test_signals.cpp226
-rw-r--r--examples/Reactor/Proactor/test_multiple_loops.cpp5
-rw-r--r--examples/Reactor/Proactor/test_proactor.cpp100
-rw-r--r--examples/Reactor/Proactor/test_proactor.mak97
-rw-r--r--examples/Reactor/Proactor/test_proactor.mdpbin52736 -> 53248 bytes
6 files changed, 133 insertions, 516 deletions
diff --git a/examples/Reactor/Misc/signal_tester.cpp b/examples/Reactor/Misc/signal_tester.cpp
deleted file mode 100644
index 37613f14f38..00000000000
--- a/examples/Reactor/Misc/signal_tester.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-// Perform an extensive test of the ACE_Reactor's event dispatching
-// $Id$
-
-// mechanisms. These mechanisms illustrate how signals, I/O, and
-// timeout events can all be handled within the same framework. In
-// addition, this example illustrates how to use the ACE_Reactor for
-// devices that perform I/O via signals (such as SVR4 message queues).
-
-
-#include "ace/Service_Config.h"
-
-// Used to shut down the event loop.
-static sig_atomic_t done = 0;
-
-// This class illustrates how to handle signal-driven I/O using the
-// ACE_Reactor framework. Note that signals may be caught and
-// processed without requiring the use of global signal handler
-// functions or global signal handler data.
-
-class Sig_Handler : public ACE_Event_Handler
-{
-public:
- Sig_Handler (void);
- virtual ACE_HANDLE get_handle (void) const;
- virtual int handle_input (ACE_HANDLE);
- virtual int shutdown (ACE_HANDLE, ACE_Reactor_Mask);
- virtual int handle_signal (ACE_HANDLE signum, siginfo_t * = 0,
- ucontext_t * = 0);
-
-private:
- ACE_HANDLE handle_;
-};
-
-// A dummy_handle is required to reserve a slot in the ACE_Reactor's
-// descriptor table.
-
-Sig_Handler::Sig_Handler (void)
-{
- // Assign the Sig_Handler a dummy I/O descriptor. Note that even
- // though we open this file "Write Only" we still need to use the
- // ACE_Event_Handler::NULL_MASK when registering this with the
- // ACE_Reactor (see below).
- this->handle_ = ACE_OS::open (ACE_DEV_NULL, O_WRONLY);
- ACE_ASSERT (this->handle_ != -1);
-
- // Register signal handler object. Note that NULL_MASK is used to
- // keep the ACE_Reactor from calling us back on the "/dev/null"
- // descriptor.
- if (ACE_Service_Config::reactor ()->register_handler
- (this, ACE_Event_Handler::NULL_MASK) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n%a", "register_handler", 1));
-
- // Create a sigset_t corresponding to the signals we want to catch.
- ACE_Sig_Set sig_set;
-
- sig_set.sig_add (SIGINT);
- sig_set.sig_add (SIGQUIT);
- sig_set.sig_add (SIGALRM);
-
- // Register the signal handler object to catch the signals.
- if (ACE_Service_Config::reactor ()->register_handler (sig_set, this) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n%a", "register_handler", 1));
-}
-
-// Called by the ACE_Reactor to extract the fd.
-
-ACE_HANDLE
-Sig_Handler::get_handle (void) const
-{
- return this->handle_;
-}
-
-// In a real application, this method would be where the read on the
-// signal-driven I/O device would occur asynchronously. For now we'll
-// just print a greeting to let you know that everything is working
-// properly!
-
-int
-Sig_Handler::handle_input (ACE_HANDLE)
-{
- ACE_DEBUG ((LM_DEBUG, "handling asynchonrous input...\n"));
- return 0;
-}
-
-// In a real application, this method would do any cleanup activities
-// required when shutting down the I/O device.
-
-int
-Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask)
-{
- ACE_DEBUG ((LM_DEBUG, "closing down Sig_Handler...\n"));
- return 0;
-}
-
-// This method handles all the signals that are being caught by this
-// object. In our simple example, we are simply catching SIGALRM,
-// SIGINT, and SIGQUIT. Anything else is logged and ignored.
-//
-// There are several advantages to using this approach. First,
-// the behavior triggered by the signal is handled in the main event
-// loop, rather than in the signal handler. Second, the ACE_Reactor's
-// signal handling mechanism eliminates the need to use global signal
-// handler functions and data.
-
-int
-Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *)
-{
- ACE_DEBUG ((LM_DEBUG, "received signal %S\n", signum));
-
- switch (signum)
- {
- case SIGALRM:
- // Rearm the alarm.
- ACE_OS::alarm (4);
- break;
- case SIGINT:
- // Tell the ACE_Reactor to enable the ready bit for
- // this->handle_. The ACE_Reactor will subsequently call the
- // Sig_Handler::handle_input method from within its event loop.
- return ACE_Service_Config::reactor ()->ready_ops
- (this->handle_, ACE_Event_Handler::READ_MASK, ACE_Reactor::ADD_MASK);
- case SIGQUIT:
- ACE_DEBUG ((LM_DEBUG, "%S: shutting down signal tester\n", signum));
- ACE_Service_Config::end_reactor_event_loop ();
- break;
- default:
- ACE_DEBUG ((LM_DEBUG,
- "%S: not handled, returning to program\n", signum));
- break;
- }
- return 0;
-}
-
-// This class illustrates that the ACE_Reactor can handle signals,
-// STDIO, and timeouts using the same mechanisms.
-
-class STDIN_Handler : public ACE_Event_Handler
-{
-public:
- STDIN_Handler (void);
- virtual int handle_input (ACE_HANDLE);
- virtual int handle_timeout (const ACE_Time_Value &,
- const void *arg);
-};
-
-STDIN_Handler::STDIN_Handler (void)
-{
- if (ACE::register_stdin_handler (this,
- ACE_Service_Config::reactor (),
- ACE_Service_Config::thr_mgr ()) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler"));
-
- // Register the STDIN_Handler to be dispatched once every second.
- else if (ACE_Service_Config::reactor ()->schedule_timer
- (this, 0, ACE_Time_Value (1), ACE_Time_Value (1)) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n%a", "schedule_timer", 1));
-}
-
-int
-STDIN_Handler::handle_timeout (const ACE_Time_Value &tv,
- const void *)
-{
- ACE_DEBUG ((LM_DEBUG, "timeout occurred at %d sec, %d usec\n",
- tv.sec (), tv.usec ()));
- return 0;
-}
-
-// Read from input descriptor and write to stdout descriptor.
-
-int
-STDIN_Handler::handle_input (ACE_HANDLE handle)
-{
- ssize_t n;
- char buf[BUFSIZ];
-
- switch (n = ACE_OS::read (handle, buf, sizeof buf))
- {
- case -1:
- if (errno == EINTR)
- return 0;
- /* NOTREACHED */
- else
- ACE_ERROR ((LM_ERROR, "%p\n", "read"));
- /* FALLTHROUGH */
- case 0:
- ACE_Service_Config::end_reactor_event_loop ();
- break;
- default:
- {
- ssize_t result = ACE::write_n (ACE_STDOUT, buf, n);
-
- if (result != n)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write"),
- result == -1 && errno == EINTR ? 0 : -1);
- }
- }
- return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- ACE_Service_Config daemon (argv [0]);
-
- // Signal handler.
- Sig_Handler sh;
-
- // Define an I/O handler object.
- STDIN_Handler ioh;
-
- // Optionally start the alarm.
- if (argc > 1)
- ACE_OS::alarm (4);
-
- // Loop handling signals and I/O events until SIGQUIT occurs.
-
- while (daemon.reactor_event_loop_done () == 0)
- daemon.run_reactor_event_loop ();
-
- return 0;
-}
diff --git a/examples/Reactor/Misc/test_signals.cpp b/examples/Reactor/Misc/test_signals.cpp
deleted file mode 100644
index 6493667de12..00000000000
--- a/examples/Reactor/Misc/test_signals.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-// Test the ability of the Reactor/Signal_Handler to register multiple
-// $Id$
-
-// handler per-signal.
-
-/* This test works as follows:
-
- 1. To test the "original" semantics of ACE (i.e., only one
- ACE_Event_Handler can be registered per signal), you don't
- need to do anything special. Existing programs work the
- same since giving the Reactor's constructor a 0 value
- (which is the default argument, BTW) instructs it to behave
- as before. When a 0 is given, the ACE_Reactor's
- constructor/open method creates an instance of
- ACE_Sig_Handler and assigns this to an internal pointer.
- This pointer is then used to dispatch all signal-related
- methods within the Reactor. The default ACE_Sig_Handler
- only allows *one* ACE_Event_Handler to be registered
- per-signal.
-
- To run this version of the test do the following:
-
- % ./test-signal
- ./test_signals
- waiting for SIGINT or SIGQUIT
- ^C
- signal Interrupt occurred in Sig_Handler_2 (fruity, 0, 0) with count = 1
- waiting for SIGINT or SIGQUIT
- ^\
- signal Quit occurred in Sig_Handler_2 (fruity, 0, 0) with count = 2
- shutting down SIGQUIT in Sig_Handler_2 (fruity, 0, 0)
- waiting for SIGINT or SIGQUIT
- ^C
- signal Interrupt occurred in Sig_Handler_2 (fruity, 0, 0) with count = 3
- waiting for SIGINT or SIGQUIT
- ^\Quit (core dumped)
-
- Note that in this test only one handler (the last one --
- "Sig_Handler_2 (fruity)") is actually registered. BTW, the
- core dump is the expected behavior since the default
- disposition is restored when there are no more handlers
- (see the code below).
-
- 2. To test the "multiple handlers per-signal semantics", you
- need to pass the constructor/open method of the ACE_Reactor
- a pointer to a an instance of ACE_Sig_Handlers (note the
- plural "s"). ACE_Sig_Handlers is a class that derives from
- ACE_Sig_Handler. The difference between these two classes
- is that (1) ACE_Sig_Handlers::register_signal allows
- multiple ACE_Event_Handlers to be registered per-signal and
- (2) it enables SA_RESTART by default. This class also
- implements Detlef Becker's algorithm for integrating ACE
- signal handling with 3rd party libraries.
-
- To run this version of the test do the following:
-
- % ./test_signals 1
-
- waiting for SIGINT or SIGQUIT
- ^C
- signal Interrupt occurred in external handler!
- signal Interrupt occurred in Sig_Handler_1 (howdy, 3, 1) with count = 1
- shutting down SIGINT in Sig_Handler_1 (howdy, 3, 1)
- signal Interrupt occurred in Sig_Handler_1 (doody, 5, 4) with count = 1
- shutting down SIGINT in Sig_Handler_1 (doody, 5, 4)
- signal Interrupt occurred in Sig_Handler_2 (tutty, 7, 6) with count = 1
- signal Interrupt occurred in Sig_Handler_2 (fruity, 9, 8) with count = 1
- waiting for SIGINT or SIGQUIT
- ^\
- signal Quit occurred in Sig_Handler_1 (howdy, 3, 1) with count = 2
- shutting down SIGQUIT in Sig_Handler_1 (howdy, 3, 1)
- signal Quit occurred in Sig_Handler_1 (doody, 5, 4) with count = 2
- shutting down SIGQUIT in Sig_Handler_1 (doody, 5, 4)
- signal Quit occurred in Sig_Handler_2 (tutty, 7, 6) with count = 2
- shutting down SIGQUIT in Sig_Handler_2 (tutty, 7, 6)
- signal Quit occurred in Sig_Handler_2 (fruity, 9, 8) with count = 2
- shutting down SIGQUIT in Sig_Handler_2 (fruity, 9, 8)
- waiting for SIGINT or SIGQUIT
- ^C
- signal Interrupt occurred in external handler!
- signal Interrupt occurred in Sig_Handler_2 (tutty, 7, 6) with count = 3
- signal Interrupt occurred in Sig_Handler_2 (fruity, 9, 8) with count = 3
- waiting for SIGINT or SIGQUIT
- ^\Quit (core dumped)
-
- When this test begins all four handlers are registered and
- dispatched when a SIGINT or SIGQUIT occurs. After the
- first SIGINT, the handle_signal method of the Sig_Handler_1
- objects unregister themselves. At that point there are 4
- SIGQUIT handlers left, but only 2 of our SIGINT handlers
- left (and the 1 external handler). After the first
- SIGQUIT, there are no SIGQUIT handlers left since they all
- deregister themselves (which restores the "SIG_DFL"
- disposition). On the second SIGINT there are only 3
- handlers left (2 of ours and 1 external). Finally, on the
- second SIGQUIT we exit and dump core since that's what
- happens with the default disposition for SIGQUIT. */
-
-#include "ace/Log_Msg.h"
-#include "ace/Reactor.h"
-
-class Sig_Handler_1 : public ACE_Event_Handler
-{
-public:
- Sig_Handler_1 (ACE_Reactor &reactor, char *msg)
- : msg_ (msg),
- count_ (0),
- reactor_ (reactor)
- {
- // Register the signal handlers.
- this->quit_sigkey_ = reactor.register_handler (SIGQUIT, this);
- this->int_sigkey_ = reactor.register_handler (SIGINT, this);
-
- if (this->quit_sigkey_ == -1 || this->int_sigkey_ == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "register_handler"));
- }
-
- virtual int handle_signal (int signum, siginfo_t *, ucontext_t *)
- {
- this->count_++;
- ACE_DEBUG ((LM_DEBUG,
- "\nsignal %S occurred in Sig_Handler_1 (%s, %d, %d) with count = %d",
- signum, this->msg_, this->int_sigkey_, this->quit_sigkey_, this->count_));
- if (this->count_ != 1 && signum == SIGQUIT)
- {
- if (this->reactor_.remove_handler (SIGQUIT, 0, 0,
- this->quit_sigkey_) == -1)
- ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler"));
- else
- ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGQUIT in Sig_Handler_1 (%s, %d, %d)",
- this->msg_, this->int_sigkey_, this->quit_sigkey_));
- }
- else if (this->count_ != 2 && signum == SIGINT)
- {
- if (this->reactor_.remove_handler (SIGINT, 0, 0,
- this->int_sigkey_) == -1)
- ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler"));
- else
- ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGINT in Sig_Handler_1 (%s, %d, %d)",
- this->msg_, this->int_sigkey_, this->quit_sigkey_));
- }
- return 0;
- }
-
-protected:
- char *msg_;
- int count_;
- int int_sigkey_;
- int quit_sigkey_;
- ACE_Reactor &reactor_;
-};
-
-class Sig_Handler_2 : public Sig_Handler_1
-{
-public:
- Sig_Handler_2 (ACE_Reactor &reactor, char *msg)
- : Sig_Handler_1 (reactor, msg)
- {
- }
-
- virtual int handle_signal (int signum, siginfo_t *, ucontext_t *)
- {
- this->count_++;
- ACE_DEBUG ((LM_DEBUG,
- "\nsignal %S occurred in Sig_Handler_2 (%s, %d, %d) with count = %d",
- signum, this->msg_, this->int_sigkey_, this->quit_sigkey_, this->count_));
- if (this->count_ != 0 && signum == SIGQUIT)
- {
- if (this->reactor_.remove_handler (SIGQUIT, 0, 0,
- this->quit_sigkey_) == -1)
- ACE_ERROR ((LM_ERROR, "\n%p", "remove_handler"));
- else
- ACE_DEBUG ((LM_DEBUG, "\nshutting down SIGQUIT in Sig_Handler_2 (%s, %d, %d)",
- this->msg_, this->int_sigkey_, this->quit_sigkey_));
- }
- else
- return 0;
- }
-};
-
-static void
-external_handler (int signum)
-{
- ACE_DEBUG ((LM_DEBUG, "\nsignal %S occurred in external handler!", signum));
-}
-
-#if !defined (HPUX)
-int
-main (int argc, char *argv)
-{
- // If argc > 1 then allow multiple handlers per-signal, else just
- // allow 1 handler per-signal.
- ACE_Sig_Handlers multi_handlers;
-
- ACE_Reactor reactor (argc > 1 ? &multi_handlers: 0);
-
- if (argc > 1)
- {
- // Register an "external" signal handler so that the
- // ACE_Sig_Handlers code will have something to incorporate!
- ACE_SignalHandler eh = ACE_SignalHandler (external_handler);
- ACE_Sig_Action sa (eh);
-
- sa.register_action (SIGINT);
- }
-
- // Create a bevy of handlers.
- Sig_Handler_1 h1 (reactor, "howdy"), h2 (reactor, "doody");
- Sig_Handler_2 h3 (reactor, "tutty"), h4 (reactor, "fruity");
-
- // Wait for user to type SIGINT and SIGQUIT.
-
- for (;;)
- {
- ACE_DEBUG ((LM_DEBUG, "\nwaiting for SIGINT or SIGQUIT\n"));
- reactor.handle_events ();
- }
- return 0;
-}
-#else
-int
-main (void)
-{
- ACE_ERROR_RETURN ((LM_ERROR, "The HP C++ compiler is too lame to support this feature\n"), -1);
-}
-#endif /* HPUX */
diff --git a/examples/Reactor/Proactor/test_multiple_loops.cpp b/examples/Reactor/Proactor/test_multiple_loops.cpp
index 9ffbf72f596..c13ebfce3eb 100644
--- a/examples/Reactor/Proactor/test_multiple_loops.cpp
+++ b/examples/Reactor/Proactor/test_multiple_loops.cpp
@@ -110,10 +110,5 @@ main (int, char *[])
ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1);
ACE_Thread_Manager::instance ()->wait ();
-
- // Remove from reactor
- ACE_Reactor::instance ()->remove_handler (&proactor,
- ACE_Event_Handler::DONT_CALL);
-
return 0;
}
diff --git a/examples/Reactor/Proactor/test_proactor.cpp b/examples/Reactor/Proactor/test_proactor.cpp
index f6ebed26c53..4582fb82888 100644
--- a/examples/Reactor/Proactor/test_proactor.cpp
+++ b/examples/Reactor/Proactor/test_proactor.cpp
@@ -34,7 +34,6 @@ static u_short port = ACE_DEFAULT_SERVER_PORT;
static char *file = "test_proactor.cpp";
static char *dump_file = "output";
static int done = 0;
-static int initial_read_size = BUFSIZ;
class Receiver : public ACE_Service_Handler
//
@@ -130,18 +129,13 @@ Receiver::open (ACE_HANDLE handle,
return;
}
- // Duplicate the message block so that we can keep it around
- ACE_Message_Block &duplicate = *message_block.duplicate ();
-
- // Initial data (data which came with the AcceptEx call)
- ACE_Asynch_Read_Stream::Result fake_result (*this,
- this->handle_,
- duplicate,
- initial_read_size,
- 0,
- ACE_INVALID_HANDLE);
- // This will call the callback
- fake_result.complete (message_block.length (), 1, 0);
+ // Print any initial data which came with the AcceptEx call
+ message_block.rd_ptr ()[message_block.length ()] = '\0';
+ ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "Initial data", message_block.rd_ptr ()));
+
+ // Initiate new read from the stream
+ if (this->initiate_read_stream () == -1)
+ return;
}
int
@@ -165,7 +159,7 @@ Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result)
ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n"));
// Reset pointers
- result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0';
+ result.message_block ().rd_ptr ()[result.message_block ().length ()] = '\0';
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ()));
@@ -182,7 +176,7 @@ Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result)
{
// Successful read: Write the data to the file.
if (this->wf_.write (result.message_block (),
- result.bytes_transferred (),
+ result.message_block ().length (),
this->file_offset_) == -1)
{
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::write"));
@@ -217,10 +211,6 @@ Receiver::handle_write_file (const ACE_Asynch_Write_File::Result &result)
if (result.success ())
// Write successful: Increment file offset
this->file_offset_ += result.bytes_transferred ();
-
- // This code is not robust enough to deal with short file writes
- // (which hardly ever happen) ;-)
- ACE_ASSERT (result.bytes_to_write () == result.bytes_transferred ());
}
class Sender : public ACE_Handler
@@ -351,6 +341,22 @@ Sender::open (const char *host,
return 0;
}
+int
+Sender::initiate_read_file (void)
+{
+ // Create Message_Block
+ ACE_Message_Block *mb = 0;
+ ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1);
+
+ // Inititiate an asynchronous read from the file
+ if (this->rf_.read (*mb,
+ mb->size () - 1,
+ this->file_offset_) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::read"), -1);
+
+ return 0;
+}
+
int
Sender::transmit_file (void)
{
@@ -410,28 +416,12 @@ Sender::handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result)
done = 1;
}
-int
-Sender::initiate_read_file (void)
-{
- // Create Message_Block
- ACE_Message_Block *mb = 0;
- ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1);
-
- // Inititiate an asynchronous read from the file
- if (this->rf_.read (*mb,
- mb->size () - 1,
- this->file_offset_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::read"), -1);
-
- return 0;
-}
-
void
Sender::handle_read_file (const ACE_Asynch_Read_File::Result &result)
{
ACE_DEBUG ((LM_DEBUG, "handle_read_file called\n"));
- result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0';
+ result.message_block ().rd_ptr ()[result.message_block ().length ()] = '\0';
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ()));
@@ -449,7 +439,7 @@ Sender::handle_read_file (const ACE_Asynch_Read_File::Result &result)
// Read successful: increment offset and write data to network
this->file_offset_ += result.bytes_transferred ();
if (this->ws_.write (result.message_block (),
- result.bytes_transferred ()) == -1)
+ result.message_block ().length ()) == -1)
{
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::write"));
return;
@@ -483,33 +473,15 @@ Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ()));
- if (result.success ())
- {
- // Partial write to socket
- int unsent_data = result.bytes_to_write () - result.bytes_transferred ();
- if (unsent_data != 0)
- {
- // Reset pointers
- result.message_block ().rd_ptr (result.bytes_transferred ());
-
- // Duplicate the message block and retry remaining data
- if (this->ws_.write (*result.message_block ().duplicate (),
- unsent_data) == -1)
- {
- ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::write"));
- return;
- }
- }
- else if (!(this->file_size_ > this->file_offset_))
- {
- this->stream_write_done_ = 1;
- if (this->transmit_file_done_)
- done = 1;
- }
- }
-
- // Release message block
result.message_block ().release ();
+
+ if (result.success ())
+ if (!(this->file_size_ > this->file_offset_))
+ {
+ this->stream_write_done_ = 1;
+ if (this->transmit_file_done_)
+ done = 1;
+ }
}
static int
@@ -560,7 +532,7 @@ main (int argc, char *argv[])
if (host == 0)
{
if (acceptor.open (ACE_INET_Addr (port),
- initial_read_size,
+ BUFSIZ,
1) == -1)
return -1;
}
diff --git a/examples/Reactor/Proactor/test_proactor.mak b/examples/Reactor/Proactor/test_proactor.mak
index 6a77e8c8547..5c011346451 100644
--- a/examples/Reactor/Proactor/test_proactor.mak
+++ b/examples/Reactor/Proactor/test_proactor.mak
@@ -245,22 +245,119 @@ CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"\
SOURCE=.\test_proactor.cpp
DEP_CPP_TEST_=\
+ "..\..\..\ace\config-win32.h"\
{$(INCLUDE)}"\ace\ACE.h"\
+ {$(INCLUDE)}"\ace\ACE.i"\
+ {$(INCLUDE)}"\ace\Addr.h"\
+ {$(INCLUDE)}"\ace\Addr.i"\
+ {$(INCLUDE)}"\ace\Asynch_Acceptor.cpp"\
{$(INCLUDE)}"\ace\Asynch_Acceptor.h"\
{$(INCLUDE)}"\ace\Asynch_Acceptor.i"\
{$(INCLUDE)}"\ace\Asynch_IO.h"\
+ {$(INCLUDE)}"\ace\Asynch_IO.i"\
+ {$(INCLUDE)}"\ace\Atomic_Op.i"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.cpp"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.h"\
+ {$(INCLUDE)}"\ace\Auto_Ptr.i"\
+ {$(INCLUDE)}"\ace\config-win32-common.h"\
+ {$(INCLUDE)}"\ace\config.h"\
+ {$(INCLUDE)}"\ace\Containers.cpp"\
+ {$(INCLUDE)}"\ace\Containers.h"\
+ {$(INCLUDE)}"\ace\Containers.i"\
+ {$(INCLUDE)}"\ace\Event_Handler.h"\
+ {$(INCLUDE)}"\ace\Event_Handler.i"\
+ {$(INCLUDE)}"\ace\Free_List.cpp"\
+ {$(INCLUDE)}"\ace\Free_List.h"\
+ {$(INCLUDE)}"\ace\Free_List.i"\
{$(INCLUDE)}"\ace\Get_Opt.h"\
{$(INCLUDE)}"\ace\Get_Opt.i"\
+ {$(INCLUDE)}"\ace\Handle_Set.h"\
+ {$(INCLUDE)}"\ace\Handle_Set.i"\
+ {$(INCLUDE)}"\ace\High_Res_Timer.h"\
+ {$(INCLUDE)}"\ace\High_Res_Timer.i"\
{$(INCLUDE)}"\ace\INET_Addr.h"\
+ {$(INCLUDE)}"\ace\INET_Addr.i"\
+ {$(INCLUDE)}"\ace\IPC_SAP.h"\
+ {$(INCLUDE)}"\ace\IPC_SAP.i"\
+ {$(INCLUDE)}"\ace\Log_Msg.h"\
+ {$(INCLUDE)}"\ace\Log_Priority.h"\
+ {$(INCLUDE)}"\ace\Log_Record.h"\
+ {$(INCLUDE)}"\ace\Log_Record.i"\
+ {$(INCLUDE)}"\ace\Malloc.h"\
+ {$(INCLUDE)}"\ace\Malloc.i"\
+ {$(INCLUDE)}"\ace\Malloc_T.cpp"\
+ {$(INCLUDE)}"\ace\Malloc_T.h"\
+ {$(INCLUDE)}"\ace\Malloc_T.i"\
+ {$(INCLUDE)}"\ace\Managed_Object.cpp"\
+ {$(INCLUDE)}"\ace\Managed_Object.h"\
+ {$(INCLUDE)}"\ace\Managed_Object.i"\
+ {$(INCLUDE)}"\ace\Mem_Map.h"\
+ {$(INCLUDE)}"\ace\Mem_Map.i"\
+ {$(INCLUDE)}"\ace\Memory_Pool.h"\
+ {$(INCLUDE)}"\ace\Memory_Pool.i"\
{$(INCLUDE)}"\ace\Message_Block.h"\
+ {$(INCLUDE)}"\ace\Message_Block.i"\
+ {$(INCLUDE)}"\ace\Object_Manager.h"\
+ {$(INCLUDE)}"\ace\Object_Manager.i"\
{$(INCLUDE)}"\ace\OS.h"\
+ {$(INCLUDE)}"\ace\OS.i"\
{$(INCLUDE)}"\ace\Proactor.h"\
+ {$(INCLUDE)}"\ace\Proactor.i"\
+ {$(INCLUDE)}"\ace\Reactor.h"\
+ {$(INCLUDE)}"\ace\Reactor.i"\
+ {$(INCLUDE)}"\ace\Reactor_Impl.h"\
{$(INCLUDE)}"\ace\Service_Config.h"\
+ {$(INCLUDE)}"\ace\Service_Config.i"\
+ {$(INCLUDE)}"\ace\Service_Object.h"\
+ {$(INCLUDE)}"\ace\Service_Object.i"\
+ {$(INCLUDE)}"\ace\Shared_Object.h"\
+ {$(INCLUDE)}"\ace\Shared_Object.i"\
+ {$(INCLUDE)}"\ace\Signal.h"\
+ {$(INCLUDE)}"\ace\Signal.i"\
+ {$(INCLUDE)}"\ace\SOCK.h"\
+ {$(INCLUDE)}"\ace\SOCK.i"\
{$(INCLUDE)}"\ace\SOCK_Acceptor.h"\
{$(INCLUDE)}"\ace\SOCK_Acceptor.i"\
{$(INCLUDE)}"\ace\SOCK_Connector.h"\
+ {$(INCLUDE)}"\ace\SOCK_Connector.i"\
+ {$(INCLUDE)}"\ace\SOCK_IO.h"\
+ {$(INCLUDE)}"\ace\SOCK_IO.i"\
{$(INCLUDE)}"\ace\SOCK_Stream.h"\
+ {$(INCLUDE)}"\ace\SOCK_Stream.i"\
+ {$(INCLUDE)}"\ace\SString.h"\
+ {$(INCLUDE)}"\ace\SString.i"\
+ {$(INCLUDE)}"\ace\stdcpp.h"\
+ {$(INCLUDE)}"\ace\SV_Semaphore_Complex.h"\
+ {$(INCLUDE)}"\ace\SV_Semaphore_Complex.i"\
+ {$(INCLUDE)}"\ace\SV_Semaphore_Simple.h"\
+ {$(INCLUDE)}"\ace\SV_Semaphore_Simple.i"\
+ {$(INCLUDE)}"\ace\Svc_Conf_Tokens.h"\
+ {$(INCLUDE)}"\ace\Synch.h"\
+ {$(INCLUDE)}"\ace\Synch.i"\
+ {$(INCLUDE)}"\ace\Synch_T.cpp"\
+ {$(INCLUDE)}"\ace\Synch_T.h"\
+ {$(INCLUDE)}"\ace\Synch_T.i"\
+ {$(INCLUDE)}"\ace\Thread.h"\
+ {$(INCLUDE)}"\ace\Thread.i"\
+ {$(INCLUDE)}"\ace\Thread_Manager.h"\
+ {$(INCLUDE)}"\ace\Thread_Manager.i"\
{$(INCLUDE)}"\ace\Time_Value.h"\
+ {$(INCLUDE)}"\ace\Timer_Heap.h"\
+ {$(INCLUDE)}"\ace\Timer_Heap_T.cpp"\
+ {$(INCLUDE)}"\ace\Timer_Heap_T.h"\
+ {$(INCLUDE)}"\ace\Timer_List.h"\
+ {$(INCLUDE)}"\ace\Timer_List_T.cpp"\
+ {$(INCLUDE)}"\ace\Timer_List_T.h"\
+ {$(INCLUDE)}"\ace\Timer_Queue.h"\
+ {$(INCLUDE)}"\ace\Timer_Queue_T.cpp"\
+ {$(INCLUDE)}"\ace\Timer_Queue_T.h"\
+ {$(INCLUDE)}"\ace\Timer_Queue_T.i"\
+ {$(INCLUDE)}"\ace\Timer_Wheel.h"\
+ {$(INCLUDE)}"\ace\Timer_Wheel_T.cpp"\
+ {$(INCLUDE)}"\ace\Timer_Wheel_T.h"\
+ {$(INCLUDE)}"\ace\Trace.h"\
+ {$(INCLUDE)}"\ace\Version.h"\
+ {$(INCLUDE)}"\ace\ws2tcpip.h"\
"$(INTDIR)\test_proactor.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
diff --git a/examples/Reactor/Proactor/test_proactor.mdp b/examples/Reactor/Proactor/test_proactor.mdp
index 2518187c3b9..7714f2926ef 100644
--- a/examples/Reactor/Proactor/test_proactor.mdp
+++ b/examples/Reactor/Proactor/test_proactor.mdp
Binary files differ