diff options
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 19 |
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__); } |