summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ThreadPool.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-01-08 21:37:57 +0000
committerMarc Laukien <marc@zeroc.com>2002-01-08 21:37:57 +0000
commitf8c70bdb7a50f59a0fa0d8f605c321126b6c4a87 (patch)
tree01fc4580a9ea1bf063f73c24e334de7950367b9c /cpp/src/Ice/ThreadPool.cpp
parentHave implemented the TimeoutException strategy for dealing with (diff)
downloadice-f8c70bdb7a50f59a0fa0d8f605c321126b6c4a87.tar.bz2
ice-f8c70bdb7a50f59a0fa0d8f605c321126b6c4a87.tar.xz
ice-f8c70bdb7a50f59a0fa0d8f605c321126b6c4a87.zip
fixes
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r--cpp/src/Ice/ThreadPool.cpp79
1 files changed, 39 insertions, 40 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 72c0c85f321..c229689e739 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -476,56 +476,55 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
{
BasicStream& stream = handler->_stream;
- if (stream.b.size() < static_cast<BasicStream::Container::size_type>(headerSize)) // Read header?
+ if (stream.b.size() == 0)
+ {
+ stream.b.resize(headerSize);
+ stream.i = stream.b.begin();
+ }
+
+ if (stream.i != stream.b.end())
{
- if (stream.b.size() == 0)
- {
- stream.b.resize(headerSize);
- stream.i = stream.b.begin();
- }
-
handler->read(stream);
- if (stream.i != stream.b.end())
- {
- return;
- }
+ assert(stream.i == stream.b.end());
}
- if (stream.b.size() >= static_cast<BasicStream::Container::size_type>(headerSize)) // Interpret header?
+ int pos = stream.i - stream.b.begin();
+ assert(pos >= headerSize);
+ stream.i = stream.b.begin();
+ Byte protVer;
+ stream.read(protVer);
+ if (protVer != protocolVersion)
+ {
+ throw UnsupportedProtocolException(__FILE__, __LINE__);
+ }
+ Byte encVer;
+ stream.read(encVer);
+ if (encVer != encodingVersion)
+ {
+ throw UnsupportedEncodingException(__FILE__, __LINE__);
+ }
+ Byte messageType;
+ stream.read(messageType);
+ Int size;
+ stream.read(size);
+ if (size < headerSize)
+ {
+ throw IllegalMessageSizeException(__FILE__, __LINE__);
+ }
+ if (size > 1024 * 1024) // TODO: configurable
+ {
+ throw MemoryLimitException(__FILE__, __LINE__);
+ }
+ if (size > static_cast<Int>(stream.b.size()))
{
- int pos = stream.i - stream.b.begin();
- stream.i = stream.b.begin();
- Byte protVer;
- stream.read(protVer);
- if (protVer != protocolVersion)
- {
- throw UnsupportedProtocolException(__FILE__, __LINE__);
- }
- Byte encVer;
- stream.read(encVer);
- if (encVer != encodingVersion)
- {
- throw UnsupportedEncodingException(__FILE__, __LINE__);
- }
- Byte messageType;
- stream.read(messageType);
- Int size;
- stream.read(size);
- if (size < headerSize)
- {
- throw IllegalMessageSizeException(__FILE__, __LINE__);
- }
- if (size > 1024 * 1024) // TODO: configurable
- {
- throw MemoryLimitException(__FILE__, __LINE__);
- }
stream.b.resize(size);
- stream.i = stream.b.begin() + pos;
}
+ stream.i = stream.b.begin() + pos;
- if (stream.b.size() > static_cast<BasicStream::Container::size_type>(headerSize) && stream.i != stream.b.end())
+ if (stream.i != stream.b.end())
{
handler->read(stream);
+ assert(stream.i == stream.b.end());
}
}