summaryrefslogtreecommitdiff
path: root/TAO/tao/GIOP_Message_State.cpp
diff options
context:
space:
mode:
authorbala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-01-11 20:03:17 +0000
committerbala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-01-11 20:03:17 +0000
commitd812c6bbc968eb630bf448ba66cd338904b99cc9 (patch)
treecfea778774c09e60739a3d85ebd986c4a1434b97 /TAO/tao/GIOP_Message_State.cpp
parent6eaea89f906fc08333c72477aacca0a205730926 (diff)
downloadATCD-d812c6bbc968eb630bf448ba66cd338904b99cc9.tar.gz
ChangeLogTag: Thu Jan 11 14:02:25 2001 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/GIOP_Message_State.cpp')
-rw-r--r--TAO/tao/GIOP_Message_State.cpp88
1 files changed, 43 insertions, 45 deletions
diff --git a/TAO/tao/GIOP_Message_State.cpp b/TAO/tao/GIOP_Message_State.cpp
index fa5abe73c41..24afe75123c 100644
--- a/TAO/tao/GIOP_Message_State.cpp
+++ b/TAO/tao/GIOP_Message_State.cpp
@@ -17,12 +17,9 @@ TAO_GIOP_Message_State::TAO_GIOP_Message_State (TAO_ORB_Core* orb_core)
more_fragments (0),
message_type (TAO_GIOP_MESSAGERROR),
message_size (0),
- current_offset (0),
- cdr (orb_core->create_input_cdr_data_block (ACE_CDR::DEFAULT_BUFSIZE),
- TAO_ENCAP_BYTE_ORDER,
- orb_core),
- fragments_begin (0),
- fragments_end (0)
+ request_id (0),
+ // Problem similar to GIOP_Message_handler.cpp - Bala
+ fragmented_messages (ACE_CDR::DEFAULT_BUFSIZE)
{
//giop_version.major = TAO_DEF_GIOP_MAJOR;
//giop_version.minor = TAO_DEF_GIOP_MINOR;
@@ -35,83 +32,84 @@ TAO_GIOP_Message_State::~TAO_GIOP_Message_State (void)
}
int
-TAO_GIOP_Message_State::is_complete ()
+TAO_GIOP_Message_State::is_complete (ACE_Message_Block &current_buf)
{
- if (this->message_size != this->current_offset)
- return 0;
-
if (this->more_fragments)
{
- // This is only one fragment of the complete Request....
- ACE_Message_Block* current =
- this->cdr.steal_contents ();
- if (this->fragments_begin == 0)
+ if (this->fragmented_messages.length () == 0)
{
this->first_fragment_byte_order = this->byte_order;
this->first_fragment_giop_version = this->giop_version;
this->first_fragment_message_type = this->message_type;
- this->fragments_end = this->fragments_begin = current;
+ // this->fragments_end = this->fragments_begin = current;
+ this->fragmented_messages.copy (current_buf.rd_ptr (),
+ current_buf.length ());
+
+ // Reset the buffer
+ current_buf.reset ();
+
+ // Reset our state
this->reset ();
return 0;
}
- return this->append_fragment (current);
+ return this->append_fragment (current_buf);
}
- if (this->fragments_begin != 0)
+ if (this->fragmented_messages.length () != 0)
{
// This is the last message, but we must defragment before
// sending
-
- ACE_Message_Block* current =
- this->cdr.steal_contents ();
- if (this->append_fragment (current) == -1)
+ if (this->append_fragment (current_buf) == -1)
return -1;
- // Copy the entire chain into the input CDR.....
- this->cdr.reset (this->fragments_begin,
- this->first_fragment_byte_order);
- ACE_Message_Block::release (this->fragments_begin);
- this->fragments_begin = 0;
- this->fragments_end = 0;
+ // Copy the entire message block into <current_buf>
+ current_buf.data_block (this->fragmented_messages.data_block ()->clone ());
+
+ this->fragmented_messages.reset ();
this->byte_order = this->first_fragment_byte_order;
this->giop_version = this->first_fragment_giop_version;
this->message_type = this->first_fragment_message_type;
- /*FALLTHROUGH*/
+ // This message has no more fragments, and there where no fragments
+ // before it, just return. Notice that current_buf has the
+ // *right* contents
}
- // else
- // {
- // This message has no more fragments, and there where no fragments
- // before it, just return... notice that this->cdr has the right
- // contents.
- // }
+
return 1;
}
int
-TAO_GIOP_Message_State::append_fragment (ACE_Message_Block* current)
+TAO_GIOP_Message_State::append_fragment (ACE_Message_Block& current)
{
- this->fragments_end->cont (current);
- this->fragments_end = this->fragments_end->cont ();
-
if (this->first_fragment_byte_order != this->byte_order
|| this->first_fragment_giop_version.major != this->giop_version.major
|| this->first_fragment_giop_version.minor != this->giop_version.minor)
{
- // Yes, print it out in all debug levels!
- // @@ Bala: i know this code is mine, but could you check out
- // the spec and the latest CORBA 2.4 draft (ptc/00-03-02) to
- // verify if this is actually an error or not? If so, could you
- // please site the right section of the spec?
+ // Yes, print it out in all debug levels!. This is an error by
+ // CORBA 2.4 spec
ACE_DEBUG ((LM_DEBUG,
- "TAO (%P|%t) incompatible fragments:\n"
- " Different GIOP versions or byte order\n"));
+ ACE_TEXT ("TAO (%P|%t) incompatible fragments:\n")
+ ACE_TEXT (" Different GIOP versions or byte order\n")));
this->reset ();
return -1;
}
+
+ size_t req_size =
+ this->fragmented_messages.size () + current.length ();
+
+ this->fragmented_messages.size (req_size);
+
+ // Copy the message
+ this->fragmented_messages.copy (current.rd_ptr (),
+ current.length ());
+
+ current.reset ();
+
+ // Reset our state
this->reset ();
+
return 0;
}