summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartinezm <martinezm@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-12-01 19:28:06 +0000
committermartinezm <martinezm@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-12-01 19:28:06 +0000
commit6577ba8b6d69839a34d260086f5d13bb55c1f6a4 (patch)
tree57e4970fd1c9946e09e2f9c74b952b32a08a1a3e
parent0e26f1a4a799cef41e664fb09fa9094c49f564f6 (diff)
downloadATCD-6577ba8b6d69839a34d260086f5d13bb55c1f6a4.tar.gz
Wed Dec 1 13:06:29 2004 Mike Martinez <martinez_m@ociweb.com>
-rw-r--r--TAO/ChangeLog467
-rw-r--r--TAO/tao/GIOP_Message_Base.cpp302
-rw-r--r--TAO/tao/GIOP_Message_State.cpp8
-rw-r--r--TAO/tao/GIOP_Message_State.h3
-rw-r--r--TAO/tao/GIOP_Message_State.inl7
-rw-r--r--TAO/tao/Transport.cpp722
6 files changed, 724 insertions, 785 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index f951560c895..bc74f78880a 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,42 @@
+Wed Dec 1 13:06:29 2004 Mike Martinez <martinez_m@ociweb.com>
+
+ * tao/GIOP_Message_Base.cpp ( process_request, process_locate_request):
+
+ Added new diagnostics.
+
+ * tao/GIOP_Message_Base.cpp ( process_request_message, process_reply_message):
+
+ Added new diagnostics. Added check for alignment with respect
+ to original header instead of message data after GIOP header.
+ When re-aligning, force the intial offset to correspond to the
+ presence of the GIOP header.
+
+ * tao/GIOP_Message_State.cpp( take_values_from_message_block):
+
+ Remove peek at request ID from request header parsing.
+
+ * tao/GIOP_Message_State.h (read_ulong, read4):
+ * tao/GIOP_Message_State.inl (read_ulong, read4):
+ * tao/GIOP_Message_State.cpp (read_ulong, read4):
+
+ Moved implementation of read_ulong into static read4 and
+ inlined read_ulong.
+
+ * tao/Transport.cpp( handle_input):
+
+ Aligned read buffer before use.
+ Cleaned up and added diagnostic messages. Conditional debug
+ code. Removed some dead code.
+
+ * tao/Transport.cpp( enqueue_incoming_message):
+
+ Peek at request Id to initialize TAO_Queued_Data object.
+
+ * tao/Transport.cpp( parse_queue_head, process_parsed_messages):
+
+ Cleaned up diagnostics, added more conditions to diagnostic
+ generation.
+
Mon Nov 15 13:45:20 2004 Mike Martinez <martinez_m@ociweb.com>
* tao/GIOP_Message_Base.cpp:
@@ -24,27 +63,27 @@ Mon Nov 15 13:45:20 2004 Mike Martinez <martinez_m@ociweb.com>
* tao/Transport.cpp (process_queue_head):
* tao/Transport.cpp (process_parsed_messages):
-
- Added more diagnostic messages.
-
+
+ Added more diagnostic messages.
+
* tao/Transport.cpp (enqueue_incoming_message):
- Removed header skip read pointer adjustments. Also removed
+ Removed header skip read pointer adjustments. Also removed
message block consolidation since a chained message is now
being passed to the protocol methods for processing.
- * tao/Transport.cpp (handle_input):
+ * tao/Transport.cpp (handle_input):
Modified to use a different processing algorithm. This will
- allocate a large buffer and read directly into this buffer. The
- buffer is managed by an ACE_Data_Block. Processing of messages
- in the buffer is performed by creating ACE_Message_Block objects
- pointing into the buffer and referencing each message header and
- message data segment in the buffer. Message blocks are chained
- if messages span single buffers as well. Header data is parsed
- and elided from the message data chain before being enqueued for
- further processing. As much data as possible is read and
- processed from the handle before yielding to the reactor.
+ allocate a large buffer and read directly into this buffer. The
+ buffer is managed by an ACE_Data_Block. Processing of messages
+ in the buffer is performed by creating ACE_Message_Block objects
+ pointing into the buffer and referencing each message header and
+ message data segment in the buffer. Message blocks are chained
+ if messages span single buffers as well. Header data is parsed
+ and elided from the message data chain before being enqueued for
+ further processing. As much data as possible is read and
+ processed from the handle before yielding to the reactor.
Thu Sep 23 19:49:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
@@ -58,268 +97,268 @@ Thu Sep 23 19:49:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
Thu Sep 23 17:48:50 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
- * tests/Sequence_Unit_Tests/string_sequence_element.hpp:
- * tests/Sequence_Unit_Tests/string_traits_base.hpp:
+ * tests/Sequence_Unit_Tests/string_sequence_element.hpp:
+ * tests/Sequence_Unit_Tests/string_traits_base.hpp:
- Left a couple of coments for Carlos.
+ Left a couple of coments for Carlos.
Wed Sep 22 21:39:48 2004 Carlos O'Ryan <coryan@atdesk.com>
- * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp:
- Add test for freebuf(), this motivated the changes below.
- Add test for to verify that index checking works.
+ * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp:
+ Add test for freebuf(), this motivated the changes below.
+ Add test for to verify that index checking works.
- * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp:
- Enable the implementation of allocbuf() and freebuf().
+ * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp:
+ Enable the implementation of allocbuf() and freebuf().
- * tests/Sequence_Unit_Tests/allocation_traits.hpp:
- Because freebuf() has such crazy requirements for sequences of
- reference-like types I had to implement special allocators for
- those types. Basically they decorate the normal allocators and
- call the ::release_range() and ::zero_range() traits in the
- element type.
+ * tests/Sequence_Unit_Tests/allocation_traits.hpp:
+ Because freebuf() has such crazy requirements for sequences of
+ reference-like types I had to implement special allocators for
+ those types. Basically they decorate the normal allocators and
+ call the ::release_range() and ::zero_range() traits in the
+ element type.
- * tests/Sequence_Unit_Tests/generic_sequence.hpp:
- Improved the documentation.
- Moved the zeroing-out of buffers to the allocation traits.
+ * tests/Sequence_Unit_Tests/generic_sequence.hpp:
+ Improved the documentation.
+ Moved the zeroing-out of buffers to the allocation traits.
- * tests/Sequence_Unit_Tests/string_traits.hpp:
- Add trait to release all the strings in a (buffer) range.
+ * tests/Sequence_Unit_Tests/string_traits.hpp:
+ Add trait to release all the strings in a (buffer) range.
Wed Sep 22 20:41:44 2004 Carlos O'Ryan <coryan@atdesk.com>
- * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp:
- * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp:
- To avoid compilation warnings on Tru64_Compaq_C++ we do not use
- explicit template intantiation, instead we just use all the
- functions.
+ * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp:
+ * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp:
+ To avoid compilation warnings on Tru64_Compaq_C++ we do not use
+ explicit template intantiation, instead we just use all the
+ functions.
Wed Sep 22 20:25:12 2004 Carlos O'Ryan <coryan@atdesk.com>
- * tests/Sequence_Unit_Tests/string_sequence_element.hpp:
- Implement the type returned by the non-const operator[] in
- string sequences. A lot of the evilness of string sequences is
- encapsulated here.
+ * tests/Sequence_Unit_Tests/string_sequence_element.hpp:
+ Implement the type returned by the non-const operator[] in
+ string sequences. A lot of the evilness of string sequences is
+ encapsulated here.
- * tests/Sequence_Unit_Tests/run_test.pl:
- * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc:
- * tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp:
- Unit test for the previous class.
+ * tests/Sequence_Unit_Tests/run_test.pl:
+ * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc:
+ * tests/Sequence_Unit_Tests/string_sequence_element_ut.cpp:
+ Unit test for the previous class.
- * tests/Sequence_Unit_Tests/string_traits_base.hpp:
- Add missing #include for the string manager types.
+ * tests/Sequence_Unit_Tests/string_traits_base.hpp:
+ Add missing #include for the string manager types.
- * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp:
- Implement the non-const operator[] to return a
- string_sequence_element<charT>.
+ * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp:
+ Implement the non-const operator[] to return a
+ string_sequence_element<charT>.
- * tests/Sequence_Unit_Tests/run_test.pl:
- * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp:
- Add more tests for copy constructors.
- Test the non-cost operator[] for sequences.
- Move the add_all() function to the end, easier to add tests that
- way.
+ * tests/Sequence_Unit_Tests/run_test.pl:
+ * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp:
+ Add more tests for copy constructors.
+ Test the non-cost operator[] for sequences.
+ Move the add_all() function to the end, easier to add tests that
+ way.
Tue Sep 21 22:11:10 2004 Carlos O'Ryan <coryan@atdesk.com>
- * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp:
- New file, this will implement (obviously enough) unbounded
- sequences of strings. The implementation is incomplete, but
- enough is there to show the main ideas and start the cycle:
- write test -> get test to compile + fail -> get test to pass
- -> rinse and repeat.
-
- * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc:
- * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp:
- Initial unit test for unbounded string sequences.
-
- * tests/Sequence_Unit_Tests/testing_counters.hpp:
- Helper classes to implement some common testing idioms, namely,
- count how many times a function is called and raise an exception
- after a prescribed number of calls.
-
- * tests/Sequence_Unit_Tests/string_traits.hpp:
- Implement the element manipulation traits for strings (and wide
- strings.)
-
- * tests/Sequence_Unit_Tests/string_traits_base.hpp:
- Isolate most of the string element manipulation traits from the
- silly CORBA names for string vs. wstring functions. Apparently
- they forgot that C++ has overloading.
-
- * tests/Sequence_Unit_Tests/testing_string_traits.hpp:
- More helper classes to write unit tests related to string
- sequences.
-
- * tests/Sequence_Unit_Tests/testing_allocation_traits.hpp:
- * tests/Sequence_Unit_Tests/value_sequence_tester.hpp:
- * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp:
- * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp:
- Refactored the code to use the testing_counters.hpp helpers.
-
- * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp:
- Wrote a unit test for the allocation traits used in testing.
- Normally I would not "test the test" but the helpers in
- testing_counters.hpp made it desirable to have this extra layer
- of checking.
+ * tests/Sequence_Unit_Tests/unbounded_string_sequence.hpp:
+ New file, this will implement (obviously enough) unbounded
+ sequences of strings. The implementation is incomplete, but
+ enough is there to show the main ideas and start the cycle:
+ write test -> get test to compile + fail -> get test to pass
+ -> rinse and repeat.
+
+ * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc:
+ * tests/Sequence_Unit_Tests/unbounded_string_sequence_ut.cpp:
+ Initial unit test for unbounded string sequences.
+
+ * tests/Sequence_Unit_Tests/testing_counters.hpp:
+ Helper classes to implement some common testing idioms, namely,
+ count how many times a function is called and raise an exception
+ after a prescribed number of calls.
+
+ * tests/Sequence_Unit_Tests/string_traits.hpp:
+ Implement the element manipulation traits for strings (and wide
+ strings.)
+
+ * tests/Sequence_Unit_Tests/string_traits_base.hpp:
+ Isolate most of the string element manipulation traits from the
+ silly CORBA names for string vs. wstring functions. Apparently
+ they forgot that C++ has overloading.
+
+ * tests/Sequence_Unit_Tests/testing_string_traits.hpp:
+ More helper classes to write unit tests related to string
+ sequences.
+
+ * tests/Sequence_Unit_Tests/testing_allocation_traits.hpp:
+ * tests/Sequence_Unit_Tests/value_sequence_tester.hpp:
+ * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp:
+ * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp:
+ Refactored the code to use the testing_counters.hpp helpers.
+
+ * tests/Sequence_Unit_Tests/testing_allocation_traits_ut.cpp:
+ Wrote a unit test for the allocation traits used in testing.
+ Normally I would not "test the test" but the helpers in
+ testing_counters.hpp made it desirable to have this extra layer
+ of checking.
Tue Sep 21 20:15:01 2004 Carlos O'Ryan <coryan@atdesk.com>
- * tests/Sequence_Unit_Tests/generic_sequence.hpp:
- Refactor the code to decompose the problem a little better.
- Basically it all boils down to creating
+ * tests/Sequence_Unit_Tests/generic_sequence.hpp:
+ Refactor the code to decompose the problem a little better.
+ Basically it all boils down to creating
- 1) A set of traits to handle buffer allocation. This
- encapsulates the bounded vs. unbounded aspect of a sequence.
+ 1) A set of traits to handle buffer allocation. This
+ encapsulates the bounded vs. unbounded aspect of a sequence.
- 2) Another set trait to handle element initialization,
- copying and destruction. This encapsulates the value
- vs. reference aspect of a sequence.
+ 2) Another set trait to handle element initialization,
+ copying and destruction. This encapsulates the value
+ vs. reference aspect of a sequence.
In the process I created smaller files to hold each class.
- The traits have an extra <bool> template parameter, whose
- motivation would hopefully become clear in a second.
+ The traits have an extra <bool> template parameter, whose
+ motivation would hopefully become clear in a second.
- * tests/Sequence_Unit_Tests/bounded_value_sequence.hpp:
- Move the implementation of bounded sequences of by-value types
- to this file.
+ * tests/Sequence_Unit_Tests/bounded_value_sequence.hpp:
+ Move the implementation of bounded sequences of by-value types
+ to this file.
- * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp:
- Unit test for bounded_value_sequence.
+ * tests/Sequence_Unit_Tests/bounded_value_sequence_ut.cpp:
+ Unit test for bounded_value_sequence.
- * tests/Sequence_Unit_Tests/unbounded_value_sequence.hpp:
- Move the implementation of unbounded sequences of by-value types
- to this file.
+ * tests/Sequence_Unit_Tests/unbounded_value_sequence.hpp:
+ Move the implementation of unbounded sequences of by-value types
+ to this file.
- * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp:
- Unit test for unbounded_value_sequence.
+ * tests/Sequence_Unit_Tests/unbounded_value_sequence_ut.cpp:
+ Unit test for unbounded_value_sequence.
- * tests/Sequence_Unit_Tests/value_sequence_tester.hpp:
- Refactor common code shared by bounded_value_sequence_ut.cpp and
- unbounded_value_sequence_ut.cpp
+ * tests/Sequence_Unit_Tests/value_sequence_tester.hpp:
+ Refactor common code shared by bounded_value_sequence_ut.cpp and
+ unbounded_value_sequence_ut.cpp
- * tests/Sequence_Unit_Tests/testing_allocation_traits.hpp:
- Specialize the allocation traits in a form suitable for
- testing. The unit tests make the traits raise exceptions in
- certain tests, and they can count how many times certain
- functions are called.
+ * tests/Sequence_Unit_Tests/testing_allocation_traits.hpp:
+ Specialize the allocation traits in a form suitable for
+ testing. The unit tests make the traits raise exceptions in
+ certain tests, and they can count how many times certain
+ functions are called.
- * tests/Sequence_Unit_Tests/testing_range_checking.hpp:
- Specializes the range_checking traits to raise an exception when
- an out-of-range access is attempted.
+ * tests/Sequence_Unit_Tests/testing_range_checking.hpp:
+ Specializes the range_checking traits to raise an exception when
+ an out-of-range access is attempted.
- * tests/Sequence_Unit_Tests/testing_exception.hpp:
- Exception raised by the testing traits.
+ * tests/Sequence_Unit_Tests/testing_exception.hpp:
+ Exception raised by the testing traits.
- * tests/Sequence_Unit_Tests/allocation_traits.hpp:
- New file, implements the allocation traits for bounded and
- unbounded sequences.
+ * tests/Sequence_Unit_Tests/allocation_traits.hpp:
+ New file, implements the allocation traits for bounded and
+ unbounded sequences.
- * tests/Sequence_Unit_Tests/value_traits.hpp:
- Implement the element manipulation traits for by-value types.
+ * tests/Sequence_Unit_Tests/value_traits.hpp:
+ Implement the element manipulation traits for by-value types.
- * tests/Sequence_Unit_Tests/range_checking.hpp:
- New file, implements yet another trait to control what are the
- effects of accessing an index out of range. The default
- implementation is a no-op, but applications can specialize the
- class to throw exceptions, call abort, phone your mom and call
- you names, whatever.
+ * tests/Sequence_Unit_Tests/range_checking.hpp:
+ New file, implements yet another trait to control what are the
+ effects of accessing an index out of range. The default
+ implementation is a no-op, but applications can specialize the
+ class to throw exceptions, call abort, phone your mom and call
+ you names, whatever.
- * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc:
- * tests/Sequence_Unit_Tests/run_test.pl:
- Removed some projects, add new ones.
+ * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc:
+ * tests/Sequence_Unit_Tests/run_test.pl:
+ Removed some projects, add new ones.
- * tests/Sequence_Unit_Tests/Bounded_Primitive_Types.cpp:
- * tests/Sequence_Unit_Tests/Unbounded_Primitive_Types.cpp:
- Removed, replaced by {bounded,unbounded}_value_sequence_ut.cpp
+ * tests/Sequence_Unit_Tests/Bounded_Primitive_Types.cpp:
+ * tests/Sequence_Unit_Tests/Unbounded_Primitive_Types.cpp:
+ Removed, replaced by {bounded,unbounded}_value_sequence_ut.cpp
- * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp:
- * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp:
- Updated to use TAO::{bounded,unbounded}_value_sequence
- vs. TAO::{bounded,unbounded}_sequence.
+ * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp:
+ * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp:
+ Updated to use TAO::{bounded,unbounded}_value_sequence
+ vs. TAO::{bounded,unbounded}_sequence.
- * tests/Sequence_Unit_Tests/sequence.hpp:
- Removed, replaced by {bounded,unbounded}_value_sequence.hpp
+ * tests/Sequence_Unit_Tests/sequence.hpp:
+ Removed, replaced by {bounded,unbounded}_value_sequence.hpp
- * tests/Sequence_Unit_Tests/sequence_traits.hpp:
- Removed, the traits have been broken up in multiple files.
+ * tests/Sequence_Unit_Tests/sequence_traits.hpp:
+ Removed, the traits have been broken up in multiple files.
Tue Sep 21 20:31:43 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
- * orbsvcs/orbsvcs/Log/LogRecordStore_persist.cpp:
- * orbsvcs/orbsvcs/Log/LogRecordStore_persist.h:
- * orbsvcs/orbsvcs/Log/PersistStore.cpp:
+ * orbsvcs/orbsvcs/Log/LogRecordStore_persist.cpp:
+ * orbsvcs/orbsvcs/Log/LogRecordStore_persist.h:
+ * orbsvcs/orbsvcs/Log/PersistStore.cpp:
- Applied patches to Logging service provided by
- Thomas Girard <thomas dot g dot girard at free.fr>.
+ Applied patches to Logging service provided by
+ Thomas Girard <thomas dot g dot girard at free.fr>.
Tue Sep 21 07:19:29 2004 J.T. Conklin <jtc@acorntoolworks.com>
- * tao/Makefile.am:
+ * tao/Makefile.am:
- Updated.
+ Updated.
Mon Sep 20 07:00:15 2004 Carlos O'Ryan <coryan@atdesk.com>
- * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp:
- * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp:
- Use the argc/argv prototype for main, apparently the ACE
- renaming of main() does not work for the other standard
- prototype for main().
+ * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp:
+ * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp:
+ Use the argc/argv prototype for main, apparently the ACE
+ renaming of main() does not work for the other standard
+ prototype for main().
Sun Sep 19 14:19:06 2004 Carlos O'Ryan <coryan@atdesk.com>
- * tests/Sequence_Unit_Tests/README:
- * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc:
- Unit tests for the CORBA sequence classes, we are currently
- replacing the implementation of CORBA sequence in TAO. In good
- TDD form I am writing the tests first, and adding them to this
- directory.
- The initial implementations will also reside in this directory
- but the plan is to move them to the library once all the
- portability bugs are cleaned up.
- If you are interested in TDD you may want to check the code to
- see how I managed to test exceptions in operator new[] without
- introducing run-time overhead. Likewise, the user can configure
- the range checking functions in CORBA sequences.
-
- * tests/Sequence_Unit_Tests/sequence_traits.hpp:
- Define trait class templates to implement sequences. These
- traits can be partially of fully specialized by the user to
- modify the default behavior.
-
- * tests/Sequence_Unit_Tests/generic_sequence.hpp:
- Generic sequence implementation, currently implements bounded
- and unbounded sequences of self-managed types, but I expect to
- implement all sequences using a single class. The variations
- between all the different sequence types will be factored out to
- trait classes.
-
- * tests/Sequence_Unit_Tests/sequence.hpp:
- The interface for unbounded and bounded sequences of
- self-managed types.
-
- * tests/Sequence_Unit_Tests/Bounded_Primitive_Types.cpp:
- * tests/Sequence_Unit_Tests/Unbounded_Primitive_Types.cpp:
- Unit tests for bounded and unbounded sequences. They are based
- on the boost unit test framework, so they only compile if boost
- is configured.
-
- * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp:
- * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp:
- Smoke test (basic compilation) for sequences of self-managed
- types. They compile on all platforms.
-
- * tests/Sequence_Unit_Tests/run_test.pl:
- Run all the tests.
+ * tests/Sequence_Unit_Tests/README:
+ * tests/Sequence_Unit_Tests/Sequence_Unit_Tests.mpc:
+ Unit tests for the CORBA sequence classes, we are currently
+ replacing the implementation of CORBA sequence in TAO. In good
+ TDD form I am writing the tests first, and adding them to this
+ directory.
+ The initial implementations will also reside in this directory
+ but the plan is to move them to the library once all the
+ portability bugs are cleaned up.
+ If you are interested in TDD you may want to check the code to
+ see how I managed to test exceptions in operator new[] without
+ introducing run-time overhead. Likewise, the user can configure
+ the range checking functions in CORBA sequences.
+
+ * tests/Sequence_Unit_Tests/sequence_traits.hpp:
+ Define trait class templates to implement sequences. These
+ traits can be partially of fully specialized by the user to
+ modify the default behavior.
+
+ * tests/Sequence_Unit_Tests/generic_sequence.hpp:
+ Generic sequence implementation, currently implements bounded
+ and unbounded sequences of self-managed types, but I expect to
+ implement all sequences using a single class. The variations
+ between all the different sequence types will be factored out to
+ trait classes.
+
+ * tests/Sequence_Unit_Tests/sequence.hpp:
+ The interface for unbounded and bounded sequences of
+ self-managed types.
+
+ * tests/Sequence_Unit_Tests/Bounded_Primitive_Types.cpp:
+ * tests/Sequence_Unit_Tests/Unbounded_Primitive_Types.cpp:
+ Unit tests for bounded and unbounded sequences. They are based
+ on the boost unit test framework, so they only compile if boost
+ is configured.
+
+ * tests/Sequence_Unit_Tests/Bounded_Simple_Types.cpp:
+ * tests/Sequence_Unit_Tests/Unbounded_Simple_Types.cpp:
+ Smoke test (basic compilation) for sequences of self-managed
+ types. They compile on all platforms.
+
+ * tests/Sequence_Unit_Tests/run_test.pl:
+ Run all the tests.
Sat Sep 18 19:32:55 2004 J.T. Conklin <jtc@acorntoolworks.com>
- * orbavcs/orbsvcs/DsLogAdmin.idl:
+ * orbavcs/orbsvcs/DsLogAdmin.idl:
- Changed to include "tao/TimeBase.pidl" instead of "TimeBase.idl"
- to avoid adding an otherwise unnecessary dependency on svc_utils
- project.
+ Changed to include "tao/TimeBase.pidl" instead of "TimeBase.idl"
+ to avoid adding an otherwise unnecessary dependency on svc_utils
+ project.
Sat Sep 18 17:16:23 2004 Olli Savia <ops@iki.fi>
diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp
index 9c217008f47..5a3d1f552e5 100644
--- a/TAO/tao/GIOP_Message_Base.cpp
+++ b/TAO/tao/GIOP_Message_Base.cpp
@@ -22,6 +22,7 @@ ACE_RCSID (tao,
GIOP_Message_Base,
"$Id$")
+namespace { enum { GIOP_HEADER_ALIGNMENT_OFFSET = 4 } ; }
TAO_GIOP_Message_Base::TAO_GIOP_Message_Base (TAO_ORB_Core *orb_core,
size_t /*input_cdr_size*/)
@@ -331,11 +332,52 @@ TAO_GIOP_Message_Base::message_type (
return TAO_PLUGGABLE_MESSAGE_MESSAGERROR;
}
+
int
TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport,
TAO_Queued_Data *qd)
-
{
+ if( TAO_debug_level > 3) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d], ")
+ ACE_TEXT("TAO_GIOP_Message_Base::process_request_message: ")
+ ACE_TEXT("entered with chained data: %s, refcount: %d, total length: %d, ")
+ ACE_TEXT("base: %x should be aligned to %d bytes.\n"),
+ transport->id (),
+ ((qd->msg_block_->cont()==0)? ACE_TEXT("no"): ACE_TEXT("yes")),
+ qd->msg_block_->data_block()->reference_count(),
+ qd->msg_block_->total_length(),
+ reinterpret_cast<int>(qd->msg_block_->rd_ptr()),
+ // ACE_CDR::LONG_ALIGN
+ ACE_CDR::MAX_ALIGNMENT
+ ));
+ }
+
+#define DEBUG_PMB_CODE
+#ifdef DEBUG_PMB_CODE
+ if( qd == 0) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d], "),
+ ACE_TEXT("TAO_GIOP_Message_Base::process_request_message: "),
+ ACE_TEXT("entered with chain: %d, refcount: %d?\n"),
+ transport->id (), (qd->msg_block_->cont()?"yes":"no"), qd->msg_block_->data_block()->reference_count() ));
+
+ } else if( qd->msg_block_ == 0) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d], "),
+ ACE_TEXT("TAO_GIOP_Message_Base::process_request_message: "),
+ ACE_TEXT("NULL CHAIN after processing!"),
+ transport->id () )) ;
+
+ } else if( qd->msg_block_->data_block()->reference_count() == 0) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d], "),
+ ACE_TEXT("TAO_GIOP_Message_Base::process_request_message: "),
+ ACE_TEXT("UNREFERENCED DATA BLOCK before processing!"),
+ transport->id () )) ;
+ }
+#endif // DEBUG_PMB_CODE
+
// Set the upcall thread
this->orb_core_->lf_strategy ().set_upcall_thread (this->orb_core_->leader_follower ());
@@ -378,10 +420,12 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport,
size_t rd_pos = qd->msg_block_->rd_ptr () - qd->msg_block_->base ();
size_t wr_pos = qd->msg_block_->wr_ptr () - qd->msg_block_->base ();
// We are now eliding the header before calling this method.
-//rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN;
+#ifdef BOGUS
+rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN;
+#endif // BOGUS
- if (TAO_debug_level > 0)
- qd->dump_msg ("recv") ;
+ if (TAO_debug_level >= 10)
+ qd->dump_msg ("request message") ;
// Create a input CDR stream.
@@ -397,10 +441,91 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport,
qd->major_version_,
qd->minor_version_,
this->orb_core_);
+ if( TAO_debug_level > 3) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d], ")
+ ACE_TEXT("TAO_GIOP_Message_Base::process_request_message: ")
+ ACE_TEXT("consolidated, refcount: %d, total length: %d\n"),
+ transport->id (),
+ input_cdr.start()->data_block()->reference_count(),
+ input_cdr.start()->total_length()
+ ));
+ }
#else // MIKE_SEZ_COPYIT
+TAO_InputCDR* real_cdr = 0 ;
+ if( qd->msg_block_->cont() == 0
+ && ((reinterpret_cast<int>(qd->msg_block_->rd_ptr()) % ACE_CDR::MAX_ALIGNMENT) == GIOP_HEADER_ALIGNMENT_OFFSET)
+ ) {
+ //
+ // The message block is not chained, use the data block directly.
+ // Indicate the read and write pointers since we are likely to only
+ // be using a portion of the underlying buffer.
+ //
+ ACE_NEW_RETURN(
+ real_cdr,
+ TAO_InputCDR(qd->msg_block_->data_block ()->duplicate(),
+ qd->msg_block_->self_flags (),
+ rd_pos,
+ wr_pos,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_
+ ),
+ -1
+ ) ;
- TAO_InputCDR input_cdr (qd->msg_block_->data_block (),
+ } else {
+ //
+ // Prepend a stack buffer with enough data to ensure correct
+ // alignment of the data.
+ //
+ char buffer[ GIOP_HEADER_ALIGNMENT_OFFSET + ACE_CDR::MAX_ALIGNMENT] ;
+ ACE_Message_Block header_proxy( buffer, GIOP_HEADER_ALIGNMENT_OFFSET) ;
+ ACE_CDR::mb_align( &header_proxy) ;
+ header_proxy.wr_ptr( GIOP_HEADER_ALIGNMENT_OFFSET) ;
+ header_proxy.cont( qd->msg_block_) ;
+
+ //
+ // The message block is chained or misaligned, consolidate the whole
+ // thing by copying, since the data conversion expects a single
+ // contiguous buffer.
+ //
+ ACE_NEW_RETURN(
+ real_cdr,
+ TAO_InputCDR( &header_proxy,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_
+ ),
+ -1
+ ) ;
+ if( TAO_debug_level > 3) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d], ")
+ ACE_TEXT("TAO_GIOP_Message_Base::process_request_message: ")
+ ACE_TEXT("consolidated, refcount: %d, total length: %d\n"),
+ transport->id (),
+ real_cdr->start()->data_block()->reference_count(),
+ real_cdr->start()->total_length()
+ ));
+ }
+
+ //
+ // Skip the empty header alignment bytes.
+ //
+ real_cdr->skip_bytes( GIOP_HEADER_ALIGNMENT_OFFSET) ;
+ }
+
+ TAO_InputCDR& input_cdr = *real_cdr ;
+
+#endif // MIKE_SEZ_COPYIT
+
+#ifdef DO_NOT_COMPILE
+
+ TAO_InputCDR input_cdr (qd->msg_block_->data_block ()->duplicate(),
qd->msg_block_->self_flags (),
rd_pos,
wr_pos,
@@ -422,7 +547,7 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport,
input_cdr.reset( qd->msg_block_, qd->byte_order_) ;
}
-#endif // MIKE_SEZ_COPYIT
+#endif // DO_NOT_COMPILE
transport->assign_translators(&input_cdr,&output);
@@ -452,6 +577,11 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport,
default:
return -1;
}
+
+#ifndef MIKE_SEZ_COPYIT
+ delete real_cdr ;
+#endif // MIKE_SEZ_COPYIT
+
}
int
@@ -459,6 +589,21 @@ TAO_GIOP_Message_Base::process_reply_message (
TAO_Pluggable_Reply_Params &params,
TAO_Queued_Data *qd)
{
+ if( TAO_debug_level > 3) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - ")
+ ACE_TEXT("TAO_GIOP_Message_Base::process_reply_message: ")
+ ACE_TEXT("entered with chained data: %s, refcount: %d, total length: %d, ")
+ ACE_TEXT("base: %x should be aligned to %d bytes.\n"),
+ ((qd->msg_block_->cont()==0)? ACE_TEXT("no"): ACE_TEXT("yes")),
+ qd->msg_block_->data_block()->reference_count(),
+ qd->msg_block_->total_length(),
+ reinterpret_cast<int>(qd->msg_block_->rd_ptr()),
+ // ACE_CDR::LONG_ALIGN
+ ACE_CDR::MAX_ALIGNMENT
+ ));
+ }
+
// Get a parser for us
TAO_GIOP_Message_Generator_Parser *generator_parser = 0;
@@ -473,8 +618,8 @@ TAO_GIOP_Message_Base::process_reply_message (
// We are now eliding the header before calling this method.
//rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN;
- if (TAO_debug_level > 0)
- qd->dump_msg ("recv");
+ if (TAO_debug_level >= 10)
+ qd->dump_msg ("reply message");
#ifdef MIKE_SEZ_COPYIT
//
@@ -490,7 +635,79 @@ TAO_GIOP_Message_Base::process_reply_message (
#else // MIKE_SEZ_COPYIT
- TAO_InputCDR input_cdr (qd->msg_block_->data_block (),
+ TAO_InputCDR* real_cdr = 0 ;
+
+ if( (qd->msg_block_->cont() == 0)
+ && ((reinterpret_cast<int>(qd->msg_block_->rd_ptr()) % ACE_CDR::MAX_ALIGNMENT) == GIOP_HEADER_ALIGNMENT_OFFSET)
+ ) {
+ //
+ // The message block is not chained, use the data block directly.
+ // Indicate the read and write pointers since we are likely to only
+ // be using a portion of the underlying buffer.
+ //
+ ACE_NEW_RETURN(
+ real_cdr,
+ TAO_InputCDR(qd->msg_block_->data_block ()->duplicate(),
+ qd->msg_block_->self_flags (),
+ rd_pos,
+ wr_pos,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_
+ ),
+ -1
+ ) ;
+
+ } else {
+ //
+ // Prepend a stack buffer with enough data to ensure correct
+ // alignment of the data.
+ //
+ char buffer[ GIOP_HEADER_ALIGNMENT_OFFSET + ACE_CDR::MAX_ALIGNMENT] ;
+ ACE_Message_Block header_proxy( buffer, GIOP_HEADER_ALIGNMENT_OFFSET) ;
+ ACE_CDR::mb_align( &header_proxy) ;
+ header_proxy.wr_ptr( GIOP_HEADER_ALIGNMENT_OFFSET) ;
+ header_proxy.cont( qd->msg_block_) ;
+
+ //
+ // The message block is chained, consolidate the whole thing by
+ // copying, since the data conversion expects a single contiguous
+ // buffer.
+ //
+ ACE_NEW_RETURN(
+ real_cdr,
+ TAO_InputCDR( &header_proxy,
+ qd->byte_order_,
+ qd->major_version_,
+ qd->minor_version_,
+ this->orb_core_
+ ),
+ -1
+ ) ;
+ if( TAO_debug_level > 3) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - ")
+ ACE_TEXT("TAO_GIOP_Message_Base::process_reply_message: ")
+ ACE_TEXT("consolidated, refcount: %d, total length: %d\n"),
+ real_cdr->start()->data_block()->reference_count(),
+ real_cdr->start()->total_length()
+ ));
+ }
+
+ //
+ // Skip the empty header alignment bytes.
+ //
+ real_cdr->skip_bytes( GIOP_HEADER_ALIGNMENT_OFFSET) ;
+ }
+
+ TAO_InputCDR& input_cdr = *real_cdr ;
+
+#endif // MIKE_SEZ_COPYIT
+
+#ifdef DO_NOT_COMPILE
+
+ TAO_InputCDR input_cdr (qd->msg_block_->data_block ()->duplicate(),
qd->msg_block_->self_flags (),
rd_pos,
wr_pos,
@@ -506,12 +723,13 @@ TAO_GIOP_Message_Base::process_reply_message (
// buffer.
//
// NOTE: This may leak the previous flavor, so we may need to manage
- // that if we pursue this change.
+ // that if we pursue this change. Do we need to reset the
+ // pointers here as well?
//
input_cdr.reset( qd->msg_block_, qd->byte_order_) ;
}
-#endif // MIKE_SEZ_COPYIT
+#endif // DO_NOT_COMPILE
// We know we have some reply message. Check whether it is a
@@ -540,6 +758,15 @@ TAO_GIOP_Message_Base::process_reply_message (
retval = -1;
}
+ if( TAO_debug_level > 3) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - ")
+ ACE_TEXT("TAO_GIOP_Message_Base::process_reply_message: ")
+ ACE_TEXT("parsed reply, return value: %d\n"),
+ retval
+ ));
+ }
+
if (retval == -1)
return retval;
@@ -548,6 +775,15 @@ TAO_GIOP_Message_Base::process_reply_message (
retval =
params.transport_->tms ()->dispatch_reply (params);
+ if( TAO_debug_level > 3) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - ")
+ ACE_TEXT("TAO_GIOP_Message_Base::process_reply_message: ")
+ ACE_TEXT("dispatched reply, return value: %d\n"),
+ retval
+ ));
+ }
+
if (retval == -1)
{
// Something really critical happened, we will forget about
@@ -559,6 +795,10 @@ TAO_GIOP_Message_Base::process_reply_message (
params.transport_->id ()));
}
+#ifndef MIKE_SEZ_COPYIT
+ delete real_cdr ;
+#endif // MIKE_SEZ_COPYIT
+
return retval;
}
@@ -662,6 +902,14 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport,
parse_error =
parser->parse_request_header (request);
+if (parse_error != 0)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - TAO_GIOP_Message_Base::process_request, ")
+ ACE_TEXT("ERROR parsing request header.\n")
+ ));
+}
+
TAO_Codeset_Manager *csm = request.orb_core()->codeset_manager();
if (csm)
csm->process_service_context(request);
@@ -677,6 +925,14 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport,
CORBA::Object_var forward_to;
+if (TAO_debug_level > 3)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - TAO_GIOP_Message_Base::process_request, ")
+ ACE_TEXT("dispatching request.\n")
+ ));
+}
+
// Do this before the reply is sent.
this->orb_core_->request_dispatcher ()->dispatch (
this->orb_core_,
@@ -685,6 +941,14 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport,
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
+if (TAO_debug_level > 3)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - TAO_GIOP_Message_Base::process_request, ")
+ ACE_TEXT("returned from dispatching request.\n")
+ ));
+}
+
if (!CORBA::is_nil (forward_to.in ()))
{
// We should forward to another object...
@@ -858,6 +1122,14 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport,
int parse_error =
parser->parse_locate_header (locate_request);
+if (parse_error != 0)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - TAO_GIOP_Message_Base::process_locate_request, ")
+ ACE_TEXT("ERROR parsing locate request header.\n")
+ ));
+}
+
if (parse_error != 0)
{
ACE_TRY_THROW (CORBA::MARSHAL (0,
@@ -887,6 +1159,14 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport,
this->orb_core_,
parse_error);
+if (parse_error != 0)
+{
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - TAO_GIOP_Message_Base::process_locate_request, ")
+ ACE_TEXT("ERROR creating server request.\n")
+ ));
+}
+
if (parse_error != 0)
{
ACE_TRY_THROW (CORBA::MARSHAL (0,
diff --git a/TAO/tao/GIOP_Message_State.cpp b/TAO/tao/GIOP_Message_State.cpp
index 462281ecfc5..3cb0592391c 100644
--- a/TAO/tao/GIOP_Message_State.cpp
+++ b/TAO/tao/GIOP_Message_State.cpp
@@ -92,7 +92,7 @@ TAO_GIOP_Message_State::take_values_from_message_block (
this->set_payload_size_from_buffer (buf);
// Get the request id
- this->parse_fragment_header (buf, mb.length ());
+// this->parse_fragment_header (buf, mb.length ());
if (this->message_size_ == 0)
{
@@ -225,8 +225,9 @@ TAO_GIOP_Message_State::parse_fragment_header (const char *buf,
return 0;
}
+/*static*/
CORBA::ULong
-TAO_GIOP_Message_State::read_ulong (const char *rd_ptr)
+TAO_GIOP_Message_State::read4 (const char *rd_ptr, const CORBA::Octet byte_order)
{
CORBA::ULong x = 0;
@@ -241,7 +242,7 @@ TAO_GIOP_Message_State::read_ulong (const char *rd_ptr)
buf[3] = *(rd_ptr + 3);
#if !defined (ACE_DISABLE_SWAP_ON_READ)
- if (!(this->byte_order_ != ACE_CDR_BYTE_ORDER))
+ if (!(byte_order != ACE_CDR_BYTE_ORDER))
{
x = *reinterpret_cast<ACE_CDR::ULong*> (buf);
}
@@ -255,3 +256,4 @@ TAO_GIOP_Message_State::read_ulong (const char *rd_ptr)
return x;
}
+
diff --git a/TAO/tao/GIOP_Message_State.h b/TAO/tao/GIOP_Message_State.h
index 9ae3db82230..a216fad4b1b 100644
--- a/TAO/tao/GIOP_Message_State.h
+++ b/TAO/tao/GIOP_Message_State.h
@@ -73,6 +73,9 @@ public:
/// Reset the state..
void reset (void);
+ /// Read 4 bytes.
+ static CORBA::ULong read4 (const char *buf, const CORBA::Octet byte_order);
+
private:
friend class TAO_GIOP_Message_Base;
diff --git a/TAO/tao/GIOP_Message_State.inl b/TAO/tao/GIOP_Message_State.inl
index 80d421c7340..463c293270e 100644
--- a/TAO/tao/GIOP_Message_State.inl
+++ b/TAO/tao/GIOP_Message_State.inl
@@ -59,3 +59,10 @@ TAO_GIOP_Message_State::set_payload_size_from_buffer (const char *rd_ptr)
this->message_size_ = this->read_ulong (rd_ptr);
}
+
+ACE_INLINE CORBA::ULong
+TAO_GIOP_Message_State::read_ulong (const char *rd_ptr)
+{
+ return TAO_GIOP_Message_State::read4( rd_ptr, this->byte_order_) ;
+}
+
diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp
index 3f0408e47a3..dd300986aab 100644
--- a/TAO/tao/Transport.cpp
+++ b/TAO/tao/Transport.cpp
@@ -1185,6 +1185,29 @@ TAO_Transport::send_message_shared_i (TAO_Stub *stub,
return 0;
}
+#define DEBUG_PMB_CODE
+#ifdef DEBUG_PMB_CODE
+static void
+dump_db_refcounts(
+ const ACE_Message_Block* b
+)
+{
+ const ACE_Data_Block* d = b->data_block() ;
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("---Chain ref count: "))) ;
+ for( ; b ; b = b->cont()) {
+ if( b->data_block() != d) {
+ d = b->data_block() ;
+ }
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("(%@) %d, "),
+ d, d->reference_count()
+ )) ;
+
+ }
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("\n"))) ;
+}
+#endif // DEBUG_PMB_CODE
+
int
TAO_Transport::queue_message_i(const ACE_Message_Block *message_block)
{
@@ -1198,16 +1221,6 @@ TAO_Transport::queue_message_i(const ACE_Message_Block *message_block)
return 0;
}
-class CTHack
-{
-public:
- CTHack() { enter(); }
- ~CTHack() { leave(); }
-private:
- void enter() { x = 1; }
- void leave() { x = 0; }
- int x;
-};
/*
*
@@ -1225,8 +1238,10 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
if (TAO_debug_level > 3)
{
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input\n"),
- this->id ()));
+ ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ")
+ ACE_TEXT("the size of the queue is [%d]\n"),
+ this->id (),
+ this->incoming_message_queue_.queue_length()));
}
// First try to process messages off the head of the incoming queue.
@@ -1245,6 +1260,14 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
return retval;
}
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ")
+ ACE_TEXT("nothing to process on queue, read from handle.\n"),
+ this->id ()));
+ }
+
//
// Loop while reads are incomplete and retries remain.
//
@@ -1273,9 +1296,9 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
->malloc( sizeof(ACE_Data_Block)),
ACE_Data_Block(
4*TAO_MAXBUFSIZE, // S/B tunable
- ACE_Message_Block::MB_DATA,
+ ACE_Message_Block::MB_DATA,
0, // Create new buffer on heap
- this->orb_core_->input_cdr_buffer_allocator(),
+ this->orb_core_->input_cdr_buffer_allocator (),
this->data_locking_strategy_, // SYNCH or NULL
0, // flags -- on the heap and fully owned!
this->orb_core_->input_cdr_dblock_allocator()
@@ -1283,15 +1306,17 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
-1
) ;
+
//
// Pass in the allocator as a courtesy to any duplicates on the
// heap.
//
ACE_Message_Block whole_block(
- data, // From above.
+ data,// ->duplicate(), // From above.
0, // flags -- on the heap and fully owned!
this->orb_core_->input_cdr_msgblock_allocator ()
) ;
+ ACE_CDR::mb_align( &whole_block) ;
//
// Greedy read - always read as much as possible.
@@ -1306,20 +1331,20 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
whole_block.wr_ptr( data_left_in_buffer) ;
if (TAO_debug_level > 3)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ")
- ACE_TEXT("read %d bytes from handle.\n"),
- this->id (), data_left_in_buffer));
- }
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ")
+ ACE_TEXT("read %d bytes from handle.\n"),
+ this->id (), data_left_in_buffer));
+ }
if (TAO_debug_level >= 10)
- {
- ACE_HEX_DUMP ((LM_DEBUG,
- (const char *) whole_block.rd_ptr(),
- data_left_in_buffer,
- ACE_TEXT ("handle data")));
- }
+ {
+ ACE_HEX_DUMP ((LM_DEBUG,
+ (const char *) whole_block.rd_ptr(),
+ data_left_in_buffer,
+ ACE_TEXT ("handle data")));
+ }
} else {
if( errno != EWOULDBLOCK && errno != EAGAIN) {
@@ -1328,6 +1353,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
//
disconnect = true ;
+// #define NO_RETRY_ON_EMPTY_HANDLE
#ifdef NO_RETRY_ON_EMPTY_HANDLE
} else {
partial = false ;
@@ -1335,10 +1361,10 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
}
- //
- // Try again or give up.
- //
- continue ;
+ //
+ // Try again or give up.
+ //
+ continue ;
}
//
@@ -1379,9 +1405,9 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
//
wanted_size
-= this->current_message_->msg_block_->total_length() ;
- }
+ }
- //
+ //
// Only process header information if we need to.
//
if( 0 < wanted_size) {
@@ -1407,22 +1433,22 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
}
if (TAO_debug_level > 3)
- {
- ACE_DEBUG ((LM_DEBUG,
+ {
+ ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ")
ACE_TEXT("processed %d header bytes, header is %s.\n"),
this->id (), current_block->length(),
(partial == true) ? ACE_TEXT("incomplete") : ACE_TEXT("complete")
));
- }
+ }
if (TAO_debug_level >= 10)
- {
+ {
ACE_HEX_DUMP ((LM_DEBUG,
(const char *) current_block->rd_ptr(),
current_block->length(),
ACE_TEXT ("handle data")));
- }
+ }
//
// Install the new block appropriately.
@@ -1453,7 +1479,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
ACE_Message_Block* location = this->current_message_->msg_block_ ;
while( location->cont() != 0) {
location = location->cont() ;
- }
+ }
if( current_block->rd_ptr() == location->wr_ptr()) {
//
// Current data follows the previous in the same buffer,
@@ -1469,6 +1495,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
//
location->cont( current_block) ;
}
+
}
//
@@ -1520,7 +1547,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
// We have a complete, aligned and contiguous, header at
// this point, so go ahead and process it.
//
- // This delegates that actual parsing actions to the protocol
+ // This delegates the actual parsing actions to the protocol
// objects.
//
if( 0 == this->messaging_object()->check_for_valid_header(
@@ -1532,7 +1559,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
disconnect = true ;
break ; // Leave the inner loop and hit the outer loop
// conditional directly.
- }
+ }
//
// This is copied from the original
@@ -1550,7 +1577,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
disconnect = true ;
break ; // Leave the inner loop and hit the outer loop
// conditional directly.
- }
+ }
//
// Update queued data state. We have not extracted any
@@ -1568,7 +1595,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
// another one.
//
continue ;
- }
+ }
//
// We have a valid message and parsed header! This means
@@ -1606,7 +1633,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
data_left_in_buffer -= wanted_size ;
this->current_message_->missing_data_bytes_ = 0 ;
this->current_message_->current_state_ = TAO_Queued_Data::COMPLETED ;
- }
+ }
if (TAO_debug_level > 3)
{
@@ -1617,7 +1644,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
ACE_TEXT("%d bytes left to read to complete message.\n"),
this->id (), current_block->length(), data_left_in_buffer,
this->current_message_->missing_data_bytes_
- ));
+ ));
}
if (TAO_debug_level >= 10)
@@ -1665,6 +1692,7 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
if( this->current_message_->current_state_
== TAO_Queued_Data::COMPLETED
) {
+#ifndef BOGUS
//
// Remove and release the header from the queued message.
// This works since we are assured that the header has been
@@ -1675,20 +1703,31 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
= this->current_message_->msg_block_->cont() ;
current_block->cont( 0) ;
current_block->release() ;
+#endif // BOGUS
if (TAO_debug_level > 3)
{
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ")
- ACE_TEXT("enqueueing message for processing.\n"),
- this->id ()));
+ ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ")
+ ACE_TEXT("enqueueing message for processing.\n"),
+ this->id ()));
+#ifdef BOGUS
+ ACE_DEBUG ((LM_DEBUG,"---Data block ref count: %d\n",
+ this->current_message_
+ ->msg_block_->cont()
+ ->data_block()
+ ->reference_count()
+ )) ;
+#else // BOGUS
ACE_DEBUG ((LM_DEBUG,"---Data block ref count: %d\n",
this->current_message_
->msg_block_
->data_block()
->reference_count()
)) ;
+#endif // BOGUS
}
+
if (TAO_debug_level >= 10)
{
this->current_message_->dump_msg( "enqueueing") ;
@@ -1715,520 +1754,29 @@ TAO_Transport::handle_input (TAO_Resume_Handle &rh,
message_enqueued = true ; // ??? or not ???
} else if( partial) {
- rh.set_flag( TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED) ;
+ rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
}
int processing_results = 0 ;
- if( message_enqueued) { // && partial == false) { // because of return val?
+ if( (message_enqueued == true) && (partial == false)) {
+ // because of return val?
processing_results = this->process_queue_head( rh) ;
}
if (TAO_debug_level > 3)
- {
- ACE_DEBUG ((LM_DEBUG,
+ {
+ ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input, ")
ACE_TEXT("returning with disconnect == %d and partial == %d and processing_results == %d\n"),
this->id (), disconnect, partial, processing_results));
- }
+ }
//
// Return an appropriate value.
//
return disconnect? -1: partial? 1: processing_results ;
-#if 0// def COMPILE_OLD_PMB_CODE_AS_WELL
- // If there are no messages then we can go ahead to read from the
- // handle for further reading..
-
- // The buffer on the stack which will be used to hold the input
- // messages
- char buf[TAO_MAXBUFSIZE];
-
-#if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE)
- (void) ACE_OS::memset (buf,
- '\0',
- sizeof buf);
-#endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */
-
- // Create a data block
- ACE_Data_Block db (sizeof (buf),
- ACE_Message_Block::MB_DATA,
- buf,
- this->orb_core_->input_cdr_buffer_allocator (),
- this->orb_core_->locking_strategy (),
- ACE_Message_Block::DONT_DELETE,
- this->orb_core_->input_cdr_dblock_allocator ());
-
- // Create a message block
- ACE_Message_Block message_block (&db,
- ACE_Message_Block::DONT_DELETE,
- this->orb_core_->input_cdr_msgblock_allocator ());
-
- // We'll loop trying to complete the message this number of times,
- // and that's it.
- unsigned int number_of_read_attempts = TAO_MAX_TRANSPORT_REREAD_ATTEMPTS;
-
- unsigned int did_queue_message = 0;
-
- // Align the message block
- ACE_CDR::mb_align (&message_block);
-
- size_t recv_size = 0;
- if (this->orb_core_->orb_params ()->single_read_optimization ())
- {
- recv_size = message_block.space ();
- }
- else
- {
- recv_size = this->messaging_object ()->header_length ();
- }
-
- // Saving the size of the received buffer in case any one needs to
- // get the size of the message thats received in the
- // context. Obviously the value will be changed for each recv call
- // and the user is supposed to invoke the accessor only in the
- // invocation context to get meaningful information.
- this->recv_buffer_size_ = recv_size;
-
- // Read the message into the message block that we have created on
- // the stack.
- ssize_t n = this->recv (message_block.wr_ptr (),
- recv_size,
- max_wait_time);
-
- // If there is an error return to the reactor..
- if (n <= 0)
- {
- return n;
- }
-
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input: ")
- ACE_TEXT("read %d bytes\n"),
- this->id (), n));
- }
-
- // Set the write pointer in the stack buffer
- message_block.wr_ptr (n);
-
- if (TAO_debug_level >= 10)
- ACE_HEX_DUMP ((LM_DEBUG,
- (const char *) message_block.rd_ptr (),
- message_block.length (),
- ACE_TEXT ("TAO (%P|%t) Transport::handle_input(): bytes read from socket")));
-
-
-complete_message_and_possibly_enqueue:
- // Check to see if we're still working to complete a message
- if (this->uncompleted_message_)
- {
- // try to complete it
-
- // on exit from this frame we have one of the following states:
- //
- // (a) an uncompleted message still in uncompleted_message_
- // AND message_block is empty
- //
- // (b) uncompleted_message_ zero, the completed message at the
- // tail of the incoming queue; message_block could be empty
- // or still contain bytes
-
- // ==> repeat
- do
- {
- /*
- * Append the "right number of bytes" to uncompleted_message_
- */
- // ==> right_number_of_bytes = MIN(bytes missing from
- // uncompleted_message_, length of message_block);
- size_t right_number_of_bytes =
- ACE_MIN (this->uncompleted_message_->missing_data_bytes_,
- message_block.length () );
-
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ")
- ACE_TEXT("trying to use %u (of %u) ")
- ACE_TEXT("bytes to complete message missing %u bytes\n"),
- this->id (),
- right_number_of_bytes,
- message_block.length (),
- this->uncompleted_message_->missing_data_bytes_));
- }
-
- // ==> append right_number_of_bytes from message_block
- // to uncomplete_message_ & update read pointer of
- // message_block;
-
- // 1. we assume that uncompleted_message_.msg_block_'s
- // wr_ptr is properly maintained
- // 2. we presume that uncompleted_message_.msg_block was
- // allocated with enough space to contain the *entire*
- // expected GIOP message, so this copy shouldn't involve an
- // additional allocation
- this->uncompleted_message_->msg_block_->copy (message_block.rd_ptr (),
- right_number_of_bytes);
- this->uncompleted_message_->missing_data_bytes_ -= right_number_of_bytes;
- message_block.rd_ptr (right_number_of_bytes);
-
- switch (this->uncompleted_message_->current_state_)
- {
- case TAO_Queued_Data::WAITING_TO_COMPLETE_HEADER:
- {
- int hdrvalidity = this->messaging_object()->check_for_valid_header (
- *this->uncompleted_message_->msg_block_);
- if (hdrvalidity == 0)
- {
- // According to the spec, Section 15.4.8, we should send
- // the MessageError GIOP message on receipt of "any message...whose
- // header is not properly formed (e.g., has the wrong magic value)".
- //
- // So, rather than returning -1, what we REALLY need to do is
- // send a MessageError in reply.
- //
- // I'm not sure what the best way to trigger that is...probably to
- // queue up a special internal-only COMPLETED message that, when
- // processed, sends the MessageError as part of its processing.
- return -1;
- }
- else if (hdrvalidity == 1)
- {
- // ==> update bytes missing from uncompleted_message_
- // with size of message from valid header;
- this->messaging_object()->set_queued_data_from_message_header (
- this->uncompleted_message_,
- *this->uncompleted_message_->msg_block_);
- // ==> change state of uncompleted_event_ to
- // WAITING_TO_COMPLETE_PAYLOAD;
- this->uncompleted_message_->current_state_ =
- TAO_Queued_Data::WAITING_TO_COMPLETE_PAYLOAD;
-
- // ==> Resize the message block to have capacity for
- // the rest of the incoming message
- ACE_Message_Block & mb = *this->uncompleted_message_->msg_block_;
- ACE_CDR::grow (&mb,
- mb.size ()
- + this->uncompleted_message_->missing_data_bytes_);
-
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ")
- ACE_TEXT("found a valid header in the message; ")
- ACE_TEXT("waiting for %u bytes to complete payload\n"),
- this->id (),
- this->uncompleted_message_->missing_data_bytes_));
- }
-
- // Continue the loop...
- continue;
- }
-
- // In the case where we don't have enough information
- // (hdrvalidity == -1), we just have to fall through
- // and collect more information, i.e., bytes.
-
- }
- break;
-
- case TAO_Queued_Data::WAITING_TO_COMPLETE_PAYLOAD:
- // Here we have an opportunity to try to finish reading the
- // uncompleted message. This is a Good Idea(TM) because there are
- // good odds that either more data came available since the last
- // time we read, or that we simply didn't read the whole message on
- // the first read. So, we try to read again.
- //
- // NOTE! this changes this->uncompleted_message_!
- this->try_to_complete (max_wait_time);
-
- // ==> if (bytes missing from uncompleted_message_ == 0)
- if (this->uncompleted_message_->missing_data_bytes_ == 0)
- {
- /*
- * We completed the message! Hooray!
- */
- // ==> place uncompleted_message_ (which is now
- // complete!) at the tail of the incoming message
- // queue;
-
- // ---> NOTE: whoever pulls this off the queue must delete it!
- this->uncompleted_message_->current_state_
- = TAO_Queued_Data::COMPLETED;
-
- // @@CJC NEED TO CHECK RETURN VALUE HERE!
- this->enqueue_incoming_message (this->uncompleted_message_);
- did_queue_message = 1;
- // zero out uncompleted_message_;
- this->uncompleted_message_ = 0;
-
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ")
- ACE_TEXT("completed and queued message for processing!\n"),
- this->id ()));
- }
-
- }
- else
- {
-
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ")
- ACE_TEXT("still need %u bytes to complete uncompleted message.\n"),
- this->id (),
- this->uncompleted_message_->missing_data_bytes_));
- }
- }
- break;
-
- default:
- // @@CJC What do we do here?!
- ACE_ASSERT (! ACE_TEXT("Transport::handle_input: unexpected state")
- ACE_TEXT("in uncompleted_message_"));
- }
- }
- // Does the order of the checks matter? In both (a) and (b),
- // message_block is empty, but only in (b) is there no
- // uncompleted_message_.
- // ==> until (message_block is empty || there is no uncompleted_message_);
- // or, rewritten in C++ looping constructs
- // ==> while ( ! message_block is empty && there is an uncompleted_message_ );
- while (message_block.length() != 0 && this->uncompleted_message_);
- }
-
- // *****************************
- // @@ CJC
- //
- // Once upon a time we tried to complete reading the uncompleted
- // message here, but testing found that completing later worked
- // better.
- // *****************************
-
-
- // At this point, there should be nothing in uncompleted_message_.
- // We now need to chop up the bytes in message_block and store any
- // complete messages in the incoming message queue.
- //
- // ==> if (message_block still has data)
- if (message_block.length () != 0)
- {
- TAO_Queued_Data *complete_message = 0;
- do
- {
- if (TAO_debug_level >= 10)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("TAO (%P|%t) Transport::handle_input: ")
- ACE_TEXT("extracting complete messages\n")));
- ACE_HEX_DUMP ((LM_DEBUG,
- message_block.rd_ptr (),
- message_block.length (),
- ACE_TEXT (" from this message buffer")));
- }
-
- complete_message =
- TAO_Queued_Data::make_completed_message (
- message_block, *this->messaging_object ());
- if ((complete_message == TAO_Queued_Data::COULD_NOT_FIND_VALID_HEADER.get()) ||
- (complete_message == TAO_Queued_Data::DYNAMIC_ALLOCATION_FAILED.get()) ||
- (complete_message == TAO_Queued_Data::COULD_NOT_UNDERSTAND_HEADER.get()))
- {
- TAO_Queued_Data* qd = TAO_Queued_Data::make_close_connection ();
- this->enqueue_incoming_message (qd);
- did_queue_message = 1;
- message_block.rd_ptr (message_block.length());
- }
- else if (complete_message != TAO_Queued_Data::GENERAL_FAILURE.get())
- {
- // If it was a GENERAL FAILURE, we let it go because it might
- // be that we can complete it later.
- this->enqueue_incoming_message (complete_message);
- did_queue_message = 1;
- }
- }
- while (complete_message != TAO_Queued_Data::GENERAL_FAILURE.get());
- // On exit from this frame we have one of the following states:
- // (a) message_block is empty
- // (b) message_block contains bytes from a partial message
- }
-
- // If, at this point, there's still data in message_block, it's
- // an incomplete message. Therefore, we stuff it into the
- // uncompleted_message_ and clear out message_block.
- // ==> if (message_block still has data)
- if (message_block.length () != 0)
- {
- if (this->uncompleted_message_ != 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input:%d ")
- ACE_TEXT("have an uncompleted message I didn't expect.\n"),
- this->id (), __LINE__
- ));
- }
-
- // duplicate message_block remainder into this->uncompleted_message_
- ACE_ASSERT (this->uncompleted_message_ == 0);
- this->uncompleted_message_ =
- TAO_Queued_Data::make_uncompleted_message (&message_block,
- *this->messaging_object ());
- if (this->uncompleted_message_ == TAO_Queued_Data::GENERAL_FAILURE.get())
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input:%d ")
- ACE_TEXT("failed to create an uncompleted message.\n"),
- this->id (), __LINE__
- ));
- }
- else if ((this->uncompleted_message_ == TAO_Queued_Data::COULD_NOT_FIND_VALID_HEADER.get()) ||
- (this->uncompleted_message_ == TAO_Queued_Data::DYNAMIC_ALLOCATION_FAILED.get()) ||
- (this->uncompleted_message_ == TAO_Queued_Data::COULD_NOT_UNDERSTAND_HEADER.get()))
- {
- TAO_Queued_Data* qd = TAO_Queued_Data::make_close_connection ();
- this->enqueue_incoming_message (qd);
- did_queue_message = 1;
- message_block.rd_ptr (message_block.length());
- }
- ACE_ASSERT (this->uncompleted_message_ != 0);
-
- // In a debug build, we won't reach this point if we couldn't
- // create an uncompleted message because the above ASSERT will
- // trip. However, in an optimized build, the ASSERT isn't
- // there, so we'll go past here.
- //
- // We could put a check in here similar to the ASSERT condition,
- // but doing that would terminate this loop early and result in
- // our never processing any completed messages that were received
- // in this trip to handle_input.
- //
- // Maybe we could instead queue up a special completed message that,
- // when processed, causes the connection to get closed in a non-graceful
- // termination scenario.
- }
-
- // We should have consumed ALL the bytes by now.
- ACE_ASSERT (message_block.length () == 0);
-
- //
- // We don't want to try to re-read earlier because we may not have
- // an uncompleted message until we get to this point. So, if we did
- // it earlier, we could have missed the opportunity to complete it
- // and dispatch.
- //
- // Thanks to Bala <bala@cse.wustl.edu> for the idea to read again
- // to increase throughput!
-
- if (this->uncompleted_message_)
- {
- if (number_of_read_attempts--)
- {
- // We try to read again just in case more data arrived while
- // we were doing the stuff above. This way, we can increase
- // throughput without much of a penalty.
-
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ")
- ACE_TEXT("still have an uncompleted message; ")
- ACE_TEXT("will try %d more times before letting ")
- ACE_TEXT("somebody else have a chance.\n"),
- this->id (),
- number_of_read_attempts));
- }
-
- // We only bother trying to complete payload, not header, because the
- // retry only happens in the complete-the-payload clause above.
- if (this->uncompleted_message_->current_state_ ==
- TAO_Queued_Data::WAITING_TO_COMPLETE_PAYLOAD)
- goto complete_message_and_possibly_enqueue;
- }
- else
- {
- // The queue should be empty because it should have been processed
- // above. But I wonder if I should put a check in here anyway.
- if (TAO_debug_level > 2)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ")
- ACE_TEXT("giving up reading for now and returning ")
- ACE_TEXT("with incoming queue length = %d\n"),
- this->id (),
- this->incoming_message_queue_.queue_length ()));
- if (this->uncompleted_message_)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("(%P|%t) Transport[%d]::handle_input: ")
- ACE_TEXT("missing bytes from uncompleted message = %u\n"),
- this->id (),
- this->uncompleted_message_->missing_data_bytes_));
- }
- // tell the upper layer not to resume the handle
- rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
- return 1;
- }
- }
-
- // **** END CJC PMG CHANGES ****
-
- retval = did_queue_message ? this->process_queue_head (rh) : 1;
-
- if (retval == 1)
- {
- rh.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
- }
-
- return retval;
-
-#endif // COMPILE_OLD_PMB_CODE_AS_WELL
-}
-
-
-#if 0 // defined(COMPILE_OLD_PMB_CODE_AS_WELL)
-void
-TAO_Transport::try_to_complete (ACE_Time_Value *max_wait_time)
-{
- if (this->uncompleted_message_ == 0)
- return;
-
- ssize_t n = 0;
- size_t &missing_data = this->uncompleted_message_->missing_data_bytes_;
- ACE_Message_Block &mb = *this->uncompleted_message_->msg_block_;
-
- // Try to complete this until we error or block right here...
- for (ssize_t bytes = missing_data;
- bytes != 0;
- bytes -= n)
- {
- // .. do a read on the socket again.
- n = this->recv (mb.wr_ptr (),
- bytes,
- max_wait_time);
-
- if (TAO_debug_level > 6)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input_i, ")
- ACE_TEXT("read %d bytes on attempt\n"),
- this->id(), n));
- }
-
- if (n == 0 || n == -1)
- {
- break;
- }
-
- mb.wr_ptr (n);
- missing_data -= n;
- }
}
-#endif // defined(COMPILE_OLD_PMB_CODE_AS_WELL)
-
int
TAO_Transport::enqueue_incoming_message (TAO_Queued_Data *queueable_message)
@@ -2243,6 +1791,25 @@ TAO_Transport::enqueue_incoming_message (TAO_Queued_Data *queueable_message)
ACE_Message_Block *mb = 0;
TAO_Queued_Data *fragment_message = 0;
+ //
+ // No message block is probably a close connection message.
+ //
+ if( queueable_message->msg_block_ != 0) {
+ //
+ // Grab the message request ID. This should likely be moved out of
+ // the transport and into the protocol processing.
+ //
+ queueable_message->request_id_
+ = TAO_GIOP_Message_State::read4(
+#ifdef BOGUS
+ queueable_message->msg_block_->cont()->rd_ptr(),
+#else // BOGUS
+ queueable_message->msg_block_->rd_ptr(),
+#endif // BOGUS
+ queueable_message->byte_order_
+ ) ;
+ }
+
switch(whole)
{
case 0x0100: // GIOP 1.0
@@ -2382,17 +1949,18 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd,
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ")
- ACE_TEXT("going to protocol processing.\n"),
- this->id ()));
- ACE_DEBUG ((LM_DEBUG,"---Data block ref count: %d\n",
- qd->msg_block_->data_block()->reference_count()));
+ ACE_TEXT("going to protocol processing. ")
+ ACE_TEXT("---Data block ref count (if any): %d\n"),
+ this->id (),
+ (qd&&qd->msg_block_)?
+ qd->msg_block_->data_block()->reference_count():-1)) ;
}
- if (TAO_debug_level >= 10)
+ if (TAO_debug_level >= 10 && qd && qd->msg_block_)
{
qd->dump_msg( "dispatching") ;
}
- int result = 0;
+// int result = 0;
if (t == TAO_PLUGGABLE_MESSAGE_CLOSECONNECTION)
{
if (TAO_debug_level > 0)
@@ -2442,7 +2010,9 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd,
return -1;
}
- result = this->tms ()->dispatch_reply (params);
+/************************************************************************
+*/
+ int result = this->tms ()->dispatch_reply (params);
if (result == -1)
{
@@ -2456,6 +2026,8 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd,
return -1;
}
+/*
+************************************************************************/
}
else if (t == TAO_PLUGGABLE_MESSAGE_MESSAGERROR)
@@ -2470,6 +2042,16 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd,
}
}
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_parsed_messages, ")
+ ACE_TEXT("---Data block ref count (if any) after protocol: %d\n"),
+ this->id (),
+ (qd&&qd->msg_block_)?
+ qd->msg_block_->data_block()->reference_count():-1)) ;
+ }
+
// If not, just return back..
return 0;
}
@@ -2487,6 +2069,14 @@ TAO_Transport::process_queue_head (TAO_Resume_Handle &rh)
if (this->incoming_message_queue_.is_head_complete () != 1)
return 1;
+ if (TAO_debug_level > 3)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_queue_head ")
+ ACE_TEXT("processing a complete message.\n"),
+ this->id ()));
+ }
+
// Get the message on the head of the queue..
TAO_Queued_Data *qd =
this->incoming_message_queue_.dequeue_head ();
@@ -2495,12 +2085,13 @@ TAO_Transport::process_queue_head (TAO_Resume_Handle &rh)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("TAO (%P|%t) - Transport[%d]::process_queue_head, ")
- ACE_TEXT("dequeued message to process.\n"),
- this->id ()));
- ACE_DEBUG ((LM_DEBUG,"---Data block ref count: %d\n",
- qd->msg_block_->data_block()->reference_count())) ;
+ ACE_TEXT("dequeued message to process. ")
+ ACE_TEXT("---Data block ref count (if any): %d\n"),
+ this->id (),
+ (qd&&qd->msg_block_)?
+ qd->msg_block_->data_block()->reference_count():-1)) ;
}
- if (TAO_debug_level >= 10)
+ if (TAO_debug_level >= 10 && qd && qd->msg_block_)
{
qd->dump_msg( "dequeued") ;
}
@@ -2547,6 +2138,23 @@ TAO_Transport::process_queue_head (TAO_Resume_Handle &rh)
// Process the message...
int retval = this->process_parsed_messages (qd, rh);
+#define DEBUG_PMB_CODE
+#ifdef DEBUG_PMB_CODE
+ if( qd == 0) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input: processed a NULL message?\n"),
+ this->id ()));
+
+ } else if( qd->msg_block_ == 0) {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT("TAO (%P|%t) - Transport[%d]::handle_input: processed message with no data.\n"),
+ this->id ()));
+
+ } else if( qd->msg_block_->data_block()->reference_count() == 0) {
+ dump_db_refcounts( qd->msg_block_) ;
+ }
+#endif // DEBUG_PMB_CODE
+
// Delete the Queued_Data..
TAO_Queued_Data::release (qd);