summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ThreadPool.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-03-05 04:44:06 +0000
committerMichi Henning <michi@zeroc.com>2003-03-05 04:44:06 +0000
commitcbf6716868fd679530dc38be5b956ede9fbea612 (patch)
treebeaed87efc62a11ecdaae0778923176d6c00e31b /cpp/src/Ice/ThreadPool.cpp
parentuse depend tag (diff)
downloadice-cbf6716868fd679530dc38be5b956ede9fbea612.tar.bz2
ice-cbf6716868fd679530dc38be5b956ede9fbea612.tar.xz
ice-cbf6716868fd679530dc38be5b956ede9fbea612.zip
Merged in changes for protocol versioning.
Diffstat (limited to 'cpp/src/Ice/ThreadPool.cpp')
-rw-r--r--cpp/src/Ice/ThreadPool.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 3210f7413ff..584c08f209e 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -522,17 +522,41 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
int pos = stream.i - stream.b.begin();
assert(pos >= headerSize);
stream.i = stream.b.begin();
- Byte protVer;
- stream.read(protVer);
- if(protVer != protocolVersion)
+ MagicBytes m(sizeof(magic), 0);
+ stream.readBlob(m, sizeof(magic));
+ if(!equal(m.begin(), m.end(), magic))
{
- throw UnsupportedProtocolException(__FILE__, __LINE__);
+ BadMagicException ex(__FILE__, __LINE__);
+ ex.badMagic = m;
+ throw ex;
}
- Byte encVer;
- stream.read(encVer);
- if(encVer != encodingVersion)
+ Byte pMajor;
+ Byte pMinor;
+ stream.read(pMajor);
+ stream.read(pMinor);
+ if(pMajor != protocolMajor
+ || static_cast<unsigned char>(pMinor) > static_cast<unsigned char>(protocolMinor))
{
- throw UnsupportedEncodingException(__FILE__, __LINE__);
+ UnsupportedProtocolException ex(__FILE__, __LINE__);
+ ex.badMajor = static_cast<unsigned char>(pMajor);
+ ex.badMinor = static_cast<unsigned char>(pMinor);
+ ex.major = static_cast<unsigned char>(protocolMajor);
+ ex.minor = static_cast<unsigned char>(protocolMinor);
+ throw ex;
+ }
+ Byte eMajor;
+ Byte eMinor;
+ stream.read(eMajor);
+ stream.read(eMinor);
+ if(eMajor != encodingMajor
+ || static_cast<unsigned char>(eMinor) > static_cast<unsigned char>(encodingMinor))
+ {
+ UnsupportedEncodingException ex(__FILE__, __LINE__);
+ ex.badMajor = static_cast<unsigned char>(eMajor);
+ ex.badMinor = static_cast<unsigned char>(eMinor);
+ ex.major = static_cast<unsigned char>(encodingMajor);
+ ex.minor = static_cast<unsigned char>(encodingMinor);
+ throw ex;
}
Byte messageType;
stream.read(messageType);