summaryrefslogtreecommitdiff
path: root/TAO/tao/Transport.cpp
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2014-10-09 23:21:42 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2014-10-09 23:21:42 +0000
commitc69a346c9d042f9cea8c5cd532cc8850fe47a4b4 (patch)
treeefd0d4feba1d1c31305d9fc6990ae36d0e49d050 /TAO/tao/Transport.cpp
parent66a62f457dc98884344fdc7f27cbf0f4cd1b1377 (diff)
downloadATCD-c69a346c9d042f9cea8c5cd532cc8850fe47a4b4.tar.gz
Thu Oct 9 23:18:24 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
* tao/Transport.cpp: Incorporate a change suggested 24 April 2012 by Martin Drlik to address a problem of partial reads manifested at least by SSLIOP connections with Java peers. This patch preserves the partial message buffer in the case of a read returning an EWOULDBLOCK or EAGAIN error.
Diffstat (limited to 'TAO/tao/Transport.cpp')
-rw-r--r--TAO/tao/Transport.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp
index 6d385195fa6..f6f27c18017 100644
--- a/TAO/tao/Transport.cpp
+++ b/TAO/tao/Transport.cpp
@@ -2138,7 +2138,8 @@ TAO_Transport::handle_input_parse_data (TAO_Resume_Handle &rh,
{
recv_size -= this->partial_message_->length ();
- this->partial_message_->reset ();
+ // reset is done later to avoid problem in case of EWOULDBLOCK
+ // or EAGAIN errno
}
else
{
@@ -2161,6 +2162,10 @@ TAO_Transport::handle_input_parse_data (TAO_Resume_Handle &rh,
ACE_TEXT ("Error - endless loop detection, closing connection"),
this->id ()));
}
+ if (this->partial_message_ != 0 && this->partial_message_->length () > 0)
+ {
+ this->partial_message_->reset ();
+ }
return -1;
}
@@ -2178,11 +2183,24 @@ TAO_Transport::handle_input_parse_data (TAO_Resume_Handle &rh,
max_wait_time);
// If there is an error return to the reactor..
+ // do not reset partial message in case of n == 0 (EWOULDBLOCK || EAGAIN),
+ // we will need it during next try
if (n <= 0)
{
+ if ((n < 0) &&
+ (this->partial_message_ != 0 && this->partial_message_->length () > 0))
+ {
+ this->partial_message_->reset ();
+ }
+
return n;
}
+ if (this->partial_message_ != 0 && this->partial_message_->length () > 0)
+ {
+ this->partial_message_->reset ();
+ }
+
if (TAO_debug_level > 3)
{
TAOLIB_DEBUG ((LM_DEBUG,