summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ThreadPool.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2009-01-22 15:19:02 +0100
committerBenoit Foucher <benoit@zeroc.com>2009-01-22 15:19:02 +0100
commit3994b371119ba308c6c4f27475c1b16a1fc518eb (patch)
tree476d2e9180d79e3910430b1396431d93c43bb180 /cpp/src/Ice/ThreadPool.cpp
parentMore fixes for bug3504 and fixed bug3506 (diff)
downloadice-3994b371119ba308c6c4f27475c1b16a1fc518eb.tar.bz2
ice-3994b371119ba308c6c4f27475c1b16a1fc518eb.tar.xz
ice-3994b371119ba308c6c4f27475c1b16a1fc518eb.zip
Fixed bug 3484 & 3604
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r--cpp/src/Ice/ThreadPool.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 4b245401c3d..ab41198104c 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -480,6 +480,8 @@ IceInternal::ThreadPool::run()
}
catch(const DatagramLimitException&) // Expected.
{
+ handler->_stream.resize(0);
+ handler->_stream.i = stream.b.begin();
continue;
}
catch(const SocketException& ex)
@@ -496,6 +498,8 @@ IceInternal::ThreadPool::run()
Warning out(_instance->initializationData().logger);
out << "datagram connection exception:\n" << ex << '\n' << handler->toString();
}
+ handler->_stream.resize(0);
+ handler->_stream.i = stream.b.begin();
}
else
{
@@ -632,7 +636,17 @@ bool
IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
{
BasicStream& stream = handler->_stream;
-
+
+ if(stream.i - stream.b.begin() >= headerSize)
+ {
+ if(!handler->read(stream))
+ {
+ return false;
+ }
+ assert(stream.i == stream.b.end());
+ return true;
+ }
+
if(stream.b.size() == 0)
{
stream.b.resize(headerSize);
@@ -656,6 +670,7 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
//
throw IllegalMessageSizeException(__FILE__, __LINE__);
}
+
stream.i = stream.b.begin();
const Byte* m;
stream.readBlob(m, static_cast<Int>(sizeof(magic)));
@@ -721,8 +736,6 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
{
Warning out(_instance->initializationData().logger);
out << "DatagramLimitException: maximum size of " << pos << " exceeded";
- stream.resize(0);
- stream.i = stream.b.begin();
}
throw DatagramLimitException(__FILE__, __LINE__);
}