diff options
author | Benoit Foucher <benoit@zeroc.com> | 2013-02-28 11:59:03 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2013-02-28 11:59:03 +0100 |
commit | 48c39401d643c85e0297cd87c6d3d87763063794 (patch) | |
tree | 50a8456ede6176f0f00dcf53501cdbf55252de33 /cpp | |
parent | minor tweaks to CHANGES (diff) | |
download | ice-48c39401d643c85e0297cd87c6d3d87763063794.tar.bz2 ice-48c39401d643c85e0297cd87c6d3d87763063794.tar.xz ice-48c39401d643c85e0297cd87c6d3d87763063794.zip |
Fixed ICE-5287 - assert in connection metrics code
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 20 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index c8ea16863f2..fe36c2d908d 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -171,6 +171,10 @@ Ice::ConnectionI::Observer::startRead(Ice::Byte* i) void Ice::ConnectionI::Observer::finishRead(Ice::Byte* i) { + if(_readStreamPos == 0) + { + return; + } assert(i >= _readStreamPos); _observer->receivedBytes(static_cast<int>(i - _readStreamPos)); _readStreamPos = 0; @@ -189,12 +193,28 @@ Ice::ConnectionI::Observer::startWrite(Ice::Byte* i) void Ice::ConnectionI::Observer::finishWrite(Ice::Byte* i) { + if(_writeStreamPos == 0) + { + return; + } assert(i >= _writeStreamPos); _observer->sentBytes(static_cast<int>(i - _writeStreamPos)); _writeStreamPos = 0; } void +Ice::ConnectionI::Observer::attach(const Ice::Instrumentation::ConnectionObserverPtr& observer) +{ + ObserverHelperT::attach(observer); + if(!observer) + { + _writeStreamPos = 0; + _readStreamPos = 0; + } +} + + +void Ice::ConnectionI::OutgoingMessage::adopt(BasicStream* str) { if(adopted) diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index 21d692d7536..4252d07607f 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -77,6 +77,8 @@ class ICE_API ConnectionI : public Connection, public IceInternal::EventHandler, void startWrite(Ice::Byte*); void finishWrite(Ice::Byte*); + void attach(const Ice::Instrumentation::ConnectionObserverPtr&); + private: Ice::Byte* _readStreamPos; |