summaryrefslogtreecommitdiff
path: root/cppe/src
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/src')
-rw-r--r--cppe/src/IceE/BasicStream.cpp606
-rw-r--r--cppe/src/IceE/Buffer.cpp76
-rw-r--r--cppe/src/IceE/Communicator.cpp20
-rw-r--r--cppe/src/IceE/Cond.cpp96
-rw-r--r--cppe/src/IceE/Connection.cpp1888
-rw-r--r--cppe/src/IceE/ConvertUTF.cpp458
-rw-r--r--cppe/src/IceE/ConvertUTF.h34
-rw-r--r--cppe/src/IceE/Current.cpp46
-rw-r--r--cppe/src/IceE/DefaultsAndOverrides.cpp8
-rw-r--r--cppe/src/IceE/ExceptionBase.cpp10
-rw-r--r--cppe/src/IceE/FactoryTableDef.cpp60
-rw-r--r--cppe/src/IceE/Incoming.cpp628
-rw-r--r--cppe/src/IceE/IncomingConnectionFactory.cpp452
-rw-r--r--cppe/src/IceE/IncomingConnectionFactory.h16
-rw-r--r--cppe/src/IceE/Initialize.cpp66
-rw-r--r--cppe/src/IceE/Instance.cpp494
-rw-r--r--cppe/src/IceE/Instance.h6
-rw-r--r--cppe/src/IceE/LocalException.cpp34
-rw-r--r--cppe/src/IceE/LocatorInfo.cpp318
-rw-r--r--cppe/src/IceE/LoggerI.cpp6
-rw-r--r--cppe/src/IceE/LoggerUtil.cpp8
-rw-r--r--cppe/src/IceE/Network.cpp692
-rw-r--r--cppe/src/IceE/Object.cpp60
-rw-r--r--cppe/src/IceE/ObjectAdapter.cpp438
-rw-r--r--cppe/src/IceE/ObjectAdapterFactory.cpp118
-rw-r--r--cppe/src/IceE/ObjectAdapterFactory.h4
-rw-r--r--cppe/src/IceE/Outgoing.cpp500
-rw-r--r--cppe/src/IceE/OutgoingConnectionFactory.cpp588
-rw-r--r--cppe/src/IceE/Properties.cpp50
-rw-r--r--cppe/src/IceE/Protocol.cpp2
-rw-r--r--cppe/src/IceE/Proxy.cpp448
-rw-r--r--cppe/src/IceE/ProxyFactory.cpp108
-rw-r--r--cppe/src/IceE/RecMutex.cpp116
-rw-r--r--cppe/src/IceE/Reference.cpp466
-rw-r--r--cppe/src/IceE/Reference.h36
-rw-r--r--cppe/src/IceE/ReferenceFactory.cpp498
-rw-r--r--cppe/src/IceE/ReferenceFactory.h10
-rw-r--r--cppe/src/IceE/RouterInfo.cpp90
-rw-r--r--cppe/src/IceE/ServantManager.cpp124
-rw-r--r--cppe/src/IceE/StaticMutex.cpp12
-rw-r--r--cppe/src/IceE/StringConverter.cpp66
-rw-r--r--cppe/src/IceE/StringUtil.cpp382
-rw-r--r--cppe/src/IceE/Thread.cpp136
-rw-r--r--cppe/src/IceE/ThreadException.cpp50
-rw-r--r--cppe/src/IceE/TraceUtil.cpp334
-rw-r--r--cppe/src/IceE/Transceiver.h4
-rw-r--r--cppe/src/IceE/UUID.cpp156
-rw-r--r--cppe/src/IceE/Unicode.cpp116
-rw-r--r--cppe/src/IceE/UnknownEndpoint.cpp16
-rw-r--r--cppe/src/TcpTransport/Acceptor.cpp38
-rw-r--r--cppe/src/TcpTransport/Connector.cpp8
-rw-r--r--cppe/src/TcpTransport/EndpointFactory.cpp2
-rw-r--r--cppe/src/TcpTransport/TcpEndpoint.cpp294
-rw-r--r--cppe/src/TcpTransport/Transceiver.cpp730
54 files changed, 6013 insertions, 6009 deletions
diff --git a/cppe/src/IceE/BasicStream.cpp b/cppe/src/IceE/BasicStream.cpp
index 62424ac4afd..32a01112f7a 100644
--- a/cppe/src/IceE/BasicStream.cpp
+++ b/cppe/src/IceE/BasicStream.cpp
@@ -27,23 +27,23 @@ IceInternal::BasicStream::clear()
{
while(_currentReadEncaps && _currentReadEncaps != &_preAllocatedReadEncaps)
{
- ReadEncaps* oldEncaps = _currentReadEncaps;
- _currentReadEncaps = _currentReadEncaps->previous;
- delete oldEncaps;
+ ReadEncaps* oldEncaps = _currentReadEncaps;
+ _currentReadEncaps = _currentReadEncaps->previous;
+ delete oldEncaps;
}
while(_currentWriteEncaps && _currentWriteEncaps != &_preAllocatedWriteEncaps)
{
- WriteEncaps* oldEncaps = _currentWriteEncaps;
- _currentWriteEncaps = _currentWriteEncaps->previous;
- delete oldEncaps;
+ WriteEncaps* oldEncaps = _currentWriteEncaps;
+ _currentWriteEncaps = _currentWriteEncaps->previous;
+ delete oldEncaps;
}
while(_seqDataStack)
{
- SeqData* oldSeqData = _seqDataStack;
- _seqDataStack = _seqDataStack->previous;
- delete oldSeqData;
+ SeqData* oldSeqData = _seqDataStack;
+ _seqDataStack = _seqDataStack->previous;
+ delete oldSeqData;
}
}
@@ -65,34 +65,34 @@ IceInternal::BasicStream::swap(BasicStream& other)
if(_currentReadEncaps || other._currentReadEncaps)
{
- _preAllocatedReadEncaps.swap(other._preAllocatedReadEncaps);
+ _preAllocatedReadEncaps.swap(other._preAllocatedReadEncaps);
- if(!_currentReadEncaps)
- {
- _currentReadEncaps = &_preAllocatedReadEncaps;
- other._currentReadEncaps = 0;
- }
- else if(!other._currentReadEncaps)
- {
- other._currentReadEncaps = &other._preAllocatedReadEncaps;
- _currentReadEncaps = 0;
- }
+ if(!_currentReadEncaps)
+ {
+ _currentReadEncaps = &_preAllocatedReadEncaps;
+ other._currentReadEncaps = 0;
+ }
+ else if(!other._currentReadEncaps)
+ {
+ other._currentReadEncaps = &other._preAllocatedReadEncaps;
+ _currentReadEncaps = 0;
+ }
}
if(_currentWriteEncaps || other._currentWriteEncaps)
{
- _preAllocatedWriteEncaps.swap(other._preAllocatedWriteEncaps);
+ _preAllocatedWriteEncaps.swap(other._preAllocatedWriteEncaps);
- if(!_currentWriteEncaps)
- {
- _currentWriteEncaps = &_preAllocatedWriteEncaps;
- other._currentWriteEncaps = 0;
- }
- else if(!other._currentWriteEncaps)
- {
- other._currentWriteEncaps = &other._preAllocatedWriteEncaps;
- _currentWriteEncaps = 0;
- }
+ if(!_currentWriteEncaps)
+ {
+ _currentWriteEncaps = &_preAllocatedWriteEncaps;
+ other._currentWriteEncaps = 0;
+ }
+ else if(!other._currentWriteEncaps)
+ {
+ other._currentWriteEncaps = &other._preAllocatedWriteEncaps;
+ _currentWriteEncaps = 0;
+ }
}
std::swap(_seqDataStack, other._seqDataStack);
@@ -152,7 +152,7 @@ IceInternal::BasicStream::startSeq(int numElements, int minSize)
{
if(numElements == 0) // Optimization to avoid pushing a useless stack frame.
{
- return;
+ return;
}
//
@@ -165,17 +165,17 @@ IceInternal::BasicStream::startSeq(int numElements, int minSize)
int bytesLeft = static_cast<int>(b.end() - i);
if(_seqDataStack->previous == 0) // Outermost sequence
{
- //
- // The sequence must fit within the message.
- //
- if(numElements * minSize > bytesLeft)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
+ //
+ // The sequence must fit within the message.
+ //
+ if(numElements * minSize > bytesLeft)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
}
else // Nested sequence
{
- checkSeq(bytesLeft);
+ checkSeq(bytesLeft);
}
}
@@ -185,17 +185,17 @@ IceInternal::BasicStream::checkFixedSeq(int numElements, int elemSize)
int bytesLeft = static_cast<int>(b.end() - i);
if(_seqDataStack == 0) // Outermost sequence
{
- //
- // The sequence must fit within the message.
- //
- if(numElements * elemSize > bytesLeft)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
+ //
+ // The sequence must fit within the message.
+ //
+ if(numElements * elemSize > bytesLeft)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
}
else // Nested sequence
{
- checkSeq(bytesLeft - numElements * elemSize);
+ checkSeq(bytesLeft - numElements * elemSize);
}
}
@@ -204,7 +204,7 @@ IceInternal::BasicStream::endSeq(int sz)
{
if(sz == 0) // Pop only if something was pushed previously.
{
- return;
+ return;
}
//
@@ -251,11 +251,11 @@ IceInternal::BasicStream::skipEncaps()
read(sz);
if(sz < 0)
{
- throwNegativeSizeException(__FILE__, __LINE__);
+ throwNegativeSizeException(__FILE__, __LINE__);
}
if(i - sizeof(Int) + sz > b.end())
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
i += sz - sizeof(Int);
}
@@ -294,7 +294,7 @@ IceInternal::BasicStream::startReadSlice()
read(sz);
if(sz < 0)
{
- throwNegativeSizeException(__FILE__, __LINE__);
+ throwNegativeSizeException(__FILE__, __LINE__);
}
_readSlice = i - b.begin();
}
@@ -311,12 +311,12 @@ IceInternal::BasicStream::skipSlice()
read(sz);
if(sz < 0)
{
- throwNegativeSizeException(__FILE__, __LINE__);
+ throwNegativeSizeException(__FILE__, __LINE__);
}
i += sz - sizeof(Int);
if(i > b.end())
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
}
@@ -325,9 +325,9 @@ IceInternal::BasicStream::writeBlob(const vector<Byte>& v)
{
if(!v.empty())
{
- Container::size_type pos = b.size();
- resize(pos + v.size());
- memcpy(&b[pos], &v[0], v.size());
+ Container::size_type pos = b.size();
+ resize(pos + v.size());
+ memcpy(&b[pos], &v[0], v.size());
}
}
@@ -336,16 +336,16 @@ IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz)
{
if(sz > 0)
{
- if(b.end() - i < sz)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- vector<Byte>(i, i + sz).swap(v);
- i += sz;
+ if(b.end() - i < sz)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ vector<Byte>(i, i + sz).swap(v);
+ i += sz;
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -356,14 +356,14 @@ IceInternal::BasicStream::read(pair<const Byte*, const Byte*>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, 1);
- v.first = i;
- v.second = i + sz;
- i += sz;
+ checkFixedSeq(sz, 1);
+ v.first = i;
+ v.second = i + sz;
+ i += sz;
}
else
{
- v.first = v.second = i;
+ v.first = v.second = i;
}
}
@@ -374,9 +374,9 @@ IceInternal::BasicStream::write(const Byte* begin, const Byte* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz);
- memcpy(&b[pos], begin, sz);
+ Container::size_type pos = b.size();
+ resize(pos + sz);
+ memcpy(&b[pos], begin, sz);
}
}
@@ -387,9 +387,9 @@ IceInternal::BasicStream::write(const vector<bool>& v)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz);
- copy(v.begin(), v.end(), b.begin() + pos);
+ Container::size_type pos = b.size();
+ resize(pos + sz);
+ copy(v.begin(), v.end(), b.begin() + pos);
}
}
@@ -403,7 +403,7 @@ struct BasicStreamWriteBoolHelper
{
for(int idx = 0; idx < sz; ++idx)
{
- b[pos + idx] = static_cast<Ice::Byte>(*(begin + idx));
+ b[pos + idx] = static_cast<Ice::Byte>(*(begin + idx));
}
}
};
@@ -428,7 +428,7 @@ IceInternal::BasicStream::write(const bool* begin, const bool* end)
{
Container::size_type pos = b.size();
resize(pos + sz);
- BasicStreamWriteBoolHelper<sizeof(bool)>::write(begin, pos, b, sz);
+ BasicStreamWriteBoolHelper<sizeof(bool)>::write(begin, pos, b, sz);
}
}
@@ -461,11 +461,11 @@ struct BasicStreamReadBoolHelper
bool* array = new bool[sz];
for(int idx = 0; idx < sz; ++idx)
{
- array[idx] = static_cast<bool>(*(i + idx));
+ array[idx] = static_cast<bool>(*(i + idx));
}
v.first = array;
v.second = array + sz;
- return array;
+ return array;
}
};
@@ -476,7 +476,7 @@ struct BasicStreamReadBoolHelper<1>
{
v.first = reinterpret_cast<bool*>(i);
v.second = reinterpret_cast<bool*>(i) + sz;
- return 0;
+ return 0;
}
};
@@ -491,7 +491,7 @@ IceInternal::BasicStream::read(pair<const bool*, const bool*>& v)
if(sz > 0)
{
checkFixedSeq(sz, 1);
- result = BasicStreamReadBoolHelper<sizeof(bool)>::read(v, sz, i);
+ result = BasicStreamReadBoolHelper<sizeof(bool)>::read(v, sz, i);
i += sz;
}
else
@@ -524,7 +524,7 @@ IceInternal::BasicStream::read(Short& v)
{
if(b.end() - i < static_cast<int>(sizeof(Short)))
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Short);
@@ -546,19 +546,19 @@ IceInternal::BasicStream::write(const Short* begin, const Short* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Short));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Short));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Short) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Short);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Short) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Short);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Short));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Short));
#endif
}
}
@@ -570,26 +570,26 @@ IceInternal::BasicStream::read(vector<Short>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Short)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Short));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Short)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Short));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Short);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Short);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -641,21 +641,21 @@ IceInternal::BasicStream::write(const Int* begin, const Int* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Int));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Int));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Int) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Int);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Int) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Int);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Int));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Int));
#endif
}
}
@@ -667,28 +667,28 @@ IceInternal::BasicStream::read(vector<Int>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Int)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Int));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Int)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Int));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Int) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Int);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Int) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Int);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -769,7 +769,7 @@ IceInternal::BasicStream::read(Long& v)
{
if(b.end() - i < static_cast<int>(sizeof(Long)))
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Long);
@@ -803,25 +803,25 @@ IceInternal::BasicStream::write(const Long* begin, const Long* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Long));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Long));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Long) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Long);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Long) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Long);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Long));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Long));
#endif
}
}
@@ -833,32 +833,32 @@ IceInternal::BasicStream::read(vector<Long>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Long)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Long));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Long)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Long));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Long) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Long);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Long) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Long);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -935,7 +935,7 @@ IceInternal::BasicStream::read(Float& v)
{
if(b.end() - i < static_cast<int>(sizeof(Float)))
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Float);
@@ -961,21 +961,21 @@ IceInternal::BasicStream::write(const Float* begin, const Float* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Float));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Float));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Float) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Float);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Float) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Float);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Float));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Float));
#endif
}
}
@@ -987,28 +987,28 @@ IceInternal::BasicStream::read(vector<Float>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Float)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Float));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Float)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Float));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Float) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Float);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Float) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Float);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1100,7 +1100,7 @@ IceInternal::BasicStream::read(Double& v)
{
if(b.end() - i < static_cast<int>(sizeof(Double)))
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Double);
@@ -1145,28 +1145,28 @@ IceInternal::BasicStream::write(const Double* begin, const Double* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Double));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Double));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Double) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Double);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Double) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Double);
+ }
#elif defined(__arm__) && defined(__linux)
- const Byte* src = reinterpret_cast<const Byte*>(begin);
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
+ const Byte* src = reinterpret_cast<const Byte*>(begin);
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
dest[4] = *src++;
dest[5] = *src++;
dest[6] = *src++;
@@ -1176,9 +1176,9 @@ IceInternal::BasicStream::write(const Double* begin, const Double* end)
dest[2] = *src++;
dest[3] = *src++;
dest += sizeof(Double);
- }
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Double));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Double));
#endif
}
}
@@ -1190,47 +1190,47 @@ IceInternal::BasicStream::read(vector<Double>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Double)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Double));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Double)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Double));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Double) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Double);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Double) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Double);
+ }
#elif defined(__arm__) && defined(__linux)
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]);
- for(int j = 0 ; j < sz ; ++j)
- {
- dest[4] = *src++;
- dest[5] = *src++;
- dest[6] = *src++;
- dest[7] = *src++;
- dest[0] = *src++;
- dest[1] = *src++;
- dest[2] = *src++;
- dest[3] = *src++;
- dest += sizeof(Double);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]);
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ dest[4] = *src++;
+ dest[5] = *src++;
+ dest[6] = *src++;
+ dest[7] = *src++;
+ dest[0] = *src++;
+ dest[1] = *src++;
+ dest[2] = *src++;
+ dest[3] = *src++;
+ dest += sizeof(Double);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1381,10 +1381,10 @@ IceInternal::BasicStream::write(const string* begin, const string* end, bool con
writeSize(sz);
if(sz > 0)
{
- for(int i = 0; i < sz; ++i)
- {
- write(begin[i], convert);
- }
+ for(int i = 0; i < sz; ++i)
+ {
+ write(begin[i], convert);
+ }
}
}
@@ -1395,19 +1395,19 @@ IceInternal::BasicStream::read(vector<string>& v, bool convert)
readSize(sz);
if(sz > 0)
{
- startSeq(sz, 1);
- v.resize(sz);
- for(int i = 0; i < sz; ++i)
- {
- read(v[i], convert);
- checkSeq();
- endElement();
- }
- endSeq(sz);
+ startSeq(sz, 1);
+ v.resize(sz);
+ for(int i = 0; i < sz; ++i)
+ {
+ read(v[i], convert);
+ checkSeq();
+ endElement();
+ }
+ endSeq(sz);
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1510,7 +1510,7 @@ IceInternal::BasicStream::read(vector<wstring>& v)
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1545,33 +1545,33 @@ IceInternal::BasicStream::throwException()
read(id, false);
for(;;)
{
- //
- // Look for a factory for this ID.
- //
- UserExceptionFactoryPtr factory = factoryTable->getExceptionFactory(id);
- if(factory)
- {
- //
- // Got factory -- get the factory to instantiate the
- // exception, initialize the exception members, and throw
- // the exception.
- //
- try
- {
- factory->createAndThrow();
- }
- catch(UserException& ex)
- {
- ex.__read(this, false);
- assert(!usesClasses);
- ex.ice_throw();
- }
- }
- else
- {
- skipSlice(); // Slice off what we don't understand.
- read(id, false); // Read type id for next slice.
- }
+ //
+ // Look for a factory for this ID.
+ //
+ UserExceptionFactoryPtr factory = factoryTable->getExceptionFactory(id);
+ if(factory)
+ {
+ //
+ // Got factory -- get the factory to instantiate the
+ // exception, initialize the exception members, and throw
+ // the exception.
+ //
+ try
+ {
+ factory->createAndThrow();
+ }
+ catch(UserException& ex)
+ {
+ ex.__read(this, false);
+ assert(!usesClasses);
+ ex.ice_throw();
+ }
+ }
+ else
+ {
+ skipSlice(); // Slice off what we don't understand.
+ read(id, false); // Read type id for next slice.
+ }
}
//
diff --git a/cppe/src/IceE/Buffer.cpp b/cppe/src/IceE/Buffer.cpp
index 55ac2fb2fb6..94025d59d1e 100644
--- a/cppe/src/IceE/Buffer.cpp
+++ b/cppe/src/IceE/Buffer.cpp
@@ -35,32 +35,32 @@ IceInternal::Buffer::Container::swap(Container& other)
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
if(_buf == _fixed)
{
- if(other._buf == other._fixed)
- {
- value_type tmp[ICE_BUFFER_FIXED_SIZE];
- memcpy(tmp, _fixed, _size);
- memcpy(_fixed, other._fixed, other._size);
- memcpy(other._fixed, tmp, _size);
- }
- else
- {
- _buf = other._buf;
- memcpy(other._fixed, _fixed, _size);
- other._buf = other._fixed;
- }
+ if(other._buf == other._fixed)
+ {
+ value_type tmp[ICE_BUFFER_FIXED_SIZE];
+ memcpy(tmp, _fixed, _size);
+ memcpy(_fixed, other._fixed, other._size);
+ memcpy(other._fixed, tmp, _size);
+ }
+ else
+ {
+ _buf = other._buf;
+ memcpy(other._fixed, _fixed, _size);
+ other._buf = other._fixed;
+ }
}
else
{
- if(other._buf == other._fixed)
- {
- other._buf = _buf;
- memcpy(_fixed, other._fixed, other._size);
- _buf = _fixed;
- }
- else
- {
- std::swap(_buf, other._buf);
- }
+ if(other._buf == other._fixed)
+ {
+ other._buf = _buf;
+ memcpy(_fixed, other._fixed, other._size);
+ _buf = _fixed;
+ }
+ else
+ {
+ std::swap(_buf, other._buf);
+ }
}
#else
std::swap(_buf, other._buf);
@@ -77,8 +77,8 @@ IceInternal::Buffer::Container::clear()
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
if(_buf != _fixed)
{
- free(_buf);
- _buf = _fixed;
+ free(_buf);
+ _buf = _fixed;
}
_size = 0;
_capacity = ICE_BUFFER_FIXED_SIZE;
@@ -95,43 +95,43 @@ IceInternal::Buffer::Container::reserve(size_type n)
{
if(n > _capacity)
{
- _capacity = std::max<size_type>(n, std::min(2 * _capacity, _maxCapacity));
- _capacity = std::max<size_type>(static_cast<size_type>(240), _capacity);
+ _capacity = std::max<size_type>(n, std::min(2 * _capacity, _maxCapacity));
+ _capacity = std::max<size_type>(static_cast<size_type>(240), _capacity);
}
else if(n < _capacity)
{
- _capacity = n;
+ _capacity = n;
}
else
{
- return;
+ return;
}
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
if(_buf != _fixed)
{
- _buf = reinterpret_cast<pointer>(realloc(_buf, _capacity));
+ _buf = reinterpret_cast<pointer>(realloc(_buf, _capacity));
}
else if(_capacity > ICE_BUFFER_FIXED_SIZE)
{
- _buf = reinterpret_cast<pointer>(malloc(_capacity));
- memcpy(_buf, _fixed, _size);
+ _buf = reinterpret_cast<pointer>(malloc(_capacity));
+ memcpy(_buf, _fixed, _size);
}
#else
if(_buf)
{
- _buf = reinterpret_cast<pointer>(realloc(_buf, _capacity));
+ _buf = reinterpret_cast<pointer>(realloc(_buf, _capacity));
}
else
{
- _buf = reinterpret_cast<pointer>(malloc(_capacity));
+ _buf = reinterpret_cast<pointer>(malloc(_capacity));
}
#endif
-
+
if(!_buf)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
}
diff --git a/cppe/src/IceE/Communicator.cpp b/cppe/src/IceE/Communicator.cpp
index 2bfa0b04ee2..c25d2860d09 100644
--- a/cppe/src/IceE/Communicator.cpp
+++ b/cppe/src/IceE/Communicator.cpp
@@ -102,9 +102,9 @@ Ice::Communicator::createObjectAdapterWithEndpoints(const string& name, const st
{
return _instance->objectAdapterFactory()->createObjectAdapter(name, endpoints
#ifdef ICEE_HAS_ROUTER
- , 0
+ , 0
# endif
- );
+ );
}
#ifdef ICEE_HAS_ROUTER
@@ -178,12 +178,12 @@ Ice::Communicator::Communicator(const InitializationData& initData)
__setNoDelete(true);
try
{
- const_cast<InstancePtr&>(_instance) = new Instance(this, initData);
+ const_cast<InstancePtr&>(_instance) = new Instance(this, initData);
}
catch(...)
{
- __setNoDelete(false);
- throw;
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
}
@@ -192,8 +192,8 @@ Ice::Communicator::~Communicator()
{
if(!_instance->destroyed())
{
- Warning out(_instance->initializationData().logger);
- out << "Ice::Communicator::destroy() has not been called";
+ Warning out(_instance->initializationData().logger);
+ out << "Ice::Communicator::destroy() has not been called";
}
}
@@ -202,11 +202,11 @@ Ice::Communicator::finishSetup(int& argc, char* argv[])
{
try
{
- _instance->finishSetup(argc, argv);
+ _instance->finishSetup(argc, argv);
}
catch(...)
{
- _instance->destroy();
- throw;
+ _instance->destroy();
+ throw;
}
}
diff --git a/cppe/src/IceE/Cond.cpp b/cppe/src/IceE/Cond.cpp
index a761cb9f894..760cdd612d8 100644
--- a/cppe/src/IceE/Cond.cpp
+++ b/cppe/src/IceE/Cond.cpp
@@ -20,7 +20,7 @@ IceUtil::Semaphore::Semaphore(long initial)
_sem = CreateSemaphore(0, initial, 0x7fffffff, 0);
if(_sem == INVALID_HANDLE_VALUE)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -35,7 +35,7 @@ IceUtil::Semaphore::wait() const
int rc = WaitForSingleObject(_sem, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -47,7 +47,7 @@ IceUtil::Semaphore::timedWait(const Time& timeout) const
int rc = WaitForSingleObject(_sem, msec);
if(rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
return rc != WAIT_TIMEOUT;
}
@@ -58,7 +58,7 @@ IceUtil::Semaphore::post(int count) const
int rc = ReleaseSemaphore(_sem, count, 0);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -97,26 +97,26 @@ IceUtil::Cond::wake(bool broadcast)
if(_unblocked != 0)
{
- _blocked -= _unblocked;
- _unblocked = 0;
+ _blocked -= _unblocked;
+ _unblocked = 0;
}
if(_blocked > 0)
{
- //
- // Unblock some number of waiters.
- //
- _toUnblock = (broadcast) ? _blocked : 1;
- _internal.unlock();
- _queue.post();
+ //
+ // Unblock some number of waiters.
+ //
+ _toUnblock = (broadcast) ? _blocked : 1;
+ _internal.unlock();
+ _queue.post();
}
else
{
- //
- // Otherwise no blocked waiters, release gate & mutex.
- //
- _gate.post();
- _internal.unlock();
+ //
+ // Otherwise no blocked waiters, release gate & mutex.
+ //
+ _gate.post();
+ _internal.unlock();
}
}
@@ -136,26 +136,26 @@ IceUtil::Cond::postWait(bool timedOut) const
if(_toUnblock != 0)
{
- bool last = --_toUnblock == 0;
- _internal.unlock();
-
- if(timedOut)
- {
- _queue.wait();
- }
-
- if(last)
- {
- _gate.post();
- }
- else
- {
- _queue.post();
- }
+ bool last = --_toUnblock == 0;
+ _internal.unlock();
+
+ if(timedOut)
+ {
+ _queue.wait();
+ }
+
+ if(last)
+ {
+ _gate.post();
+ }
+ else
+ {
+ _queue.post();
+ }
}
else
{
- _internal.unlock();
+ _internal.unlock();
}
}
@@ -164,13 +164,13 @@ IceUtil::Cond::dowait() const
{
try
{
- _queue.wait();
- postWait(false);
+ _queue.wait();
+ postWait(false);
}
catch(...)
{
- postWait(false);
- throw;
+ postWait(false);
+ throw;
}
}
@@ -179,14 +179,14 @@ IceUtil::Cond::timedDowait(const Time& timeout) const
{
try
{
- bool rc = _queue.timedWait(timeout);
- postWait(!rc);
- return rc;
+ bool rc = _queue.timedWait(timeout);
+ postWait(!rc);
+ return rc;
}
catch(...)
{
- postWait(false);
- throw;
+ postWait(false);
+ throw;
}
}
@@ -201,19 +201,19 @@ IceUtil::Cond::Cond()
rc = pthread_condattr_init(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_cond_init(&_cond, &attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_condattr_destroy(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -230,7 +230,7 @@ IceUtil::Cond::signal()
int rc = pthread_cond_signal(&_cond);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -240,7 +240,7 @@ IceUtil::Cond::broadcast()
int rc = pthread_cond_broadcast(&_cond);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
diff --git a/cppe/src/IceE/Connection.cpp b/cppe/src/IceE/Connection.cpp
index 122f61a6aaf..f133b99f572 100644
--- a/cppe/src/IceE/Connection.cpp
+++ b/cppe/src/IceE/Connection.cpp
@@ -41,13 +41,13 @@ Ice::Connection::waitForValidation()
while(_state == StateNotValidated)
{
- wait();
+ wait();
}
if(_state >= StateClosing)
{
- assert(_exception.get());
- _exception->ice_throw();
+ assert(_exception.get());
+ _exception->ice_throw();
}
}
@@ -75,18 +75,18 @@ Ice::Connection::destroy(DestructionReason reason)
switch(reason)
{
#ifndef ICEE_PURE_CLIENT
- case ObjectAdapterDeactivated:
- {
- setState(StateClosing, ObjectAdapterDeactivatedException(__FILE__, __LINE__));
- break;
- }
+ case ObjectAdapterDeactivated:
+ {
+ setState(StateClosing, ObjectAdapterDeactivatedException(__FILE__, __LINE__));
+ break;
+ }
#endif
- case CommunicatorDestroyed:
- {
- setState(StateClosing, CommunicatorDestroyedException(__FILE__, __LINE__));
- break;
- }
+ case CommunicatorDestroyed:
+ {
+ setState(StateClosing, CommunicatorDestroyedException(__FILE__, __LINE__));
+ break;
+ }
}
}
@@ -97,25 +97,25 @@ Ice::Connection::close(bool force)
if(force)
{
- setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
+ setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
}
else
{
#ifndef ICEE_PURE_BLOCKING_CLIENT
- //
- // If we do a graceful shutdown, then we wait until all
- // outstanding requests have been completed. Otherwise, the
- // CloseConnectionException will cause all outstanding
- // requests to be retried, regardless of whether the server
- // has processed them or not.
- //
- while(!_requests.empty())
- {
- wait();
- }
+ //
+ // If we do a graceful shutdown, then we wait until all
+ // outstanding requests have been completed. Otherwise, the
+ // CloseConnectionException will cause all outstanding
+ // requests to be retried, regardless of whether the server
+ // has processed them or not.
+ //
+ while(!_requests.empty())
+ {
+ wait();
+ }
#endif
- setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
+ setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
}
}
@@ -140,32 +140,32 @@ Ice::Connection::isFinished() const
#endif
{
- //
- // We can use trylock here, because as long as there are still
- // threads operating in this connection object, connection
- // destruction is considered as not yet finished.
- //
- IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this);
-
- if(!sync.acquired())
- {
- return false;
- }
+ //
+ // We can use trylock here, because as long as there are still
+ // threads operating in this connection object, connection
+ // destruction is considered as not yet finished.
+ //
+ IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this);
+
+ if(!sync.acquired())
+ {
+ return false;
+ }
- if(_transceiver != 0
+ if(_transceiver != 0
#ifndef ICEE_PURE_BLOCKING_CLIENT
- || _dispatchCount != 0 || (_threadPerConnection && _threadPerConnection->isAlive())
+ || _dispatchCount != 0 || (_threadPerConnection && _threadPerConnection->isAlive())
#endif
- )
- {
- return false;
- }
+ )
+ {
+ return false;
+ }
- assert(_state == StateClosed);
+ assert(_state == StateClosed);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- threadPerConnection = _threadPerConnection;
- _threadPerConnection = 0;
+ threadPerConnection = _threadPerConnection;
+ _threadPerConnection = 0;
#endif
}
@@ -200,7 +200,7 @@ Ice::Connection::waitUntilHolding() const
while(_state < StateHolding || _dispatchCount > 0)
{
- wait();
+ wait();
}
}
@@ -214,74 +214,74 @@ Ice::Connection::waitUntilFinished()
#endif
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // We wait indefinitely until connection closing has been
- // initiated. We also wait indefinitely until all outstanding
- // requests are completed. Otherwise we couldn't guarantee
- // that there are no outstanding calls when deactivate() is
- // called on the servant locators.
- //
- while(_state < StateClosing || _dispatchCount > 0)
- {
- wait();
- }
-
- //
- // Now we must wait until close() has been called on the
- // transceiver.
- //
- while(_transceiver)
- {
- if(_state != StateClosed && _endpoint->timeout() >= 0)
- {
- IceUtil::Time timeout = IceUtil::Time::milliSeconds(_endpoint->timeout());
- IceUtil::Time waitTime = _stateTime + timeout - IceUtil::Time::now();
-
- if(waitTime > IceUtil::Time())
- {
- //
- // We must wait a bit longer until we close this
- // connection.
- //
- if(!timedWait(waitTime))
- {
- setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
- }
- }
- else
- {
- //
- // We already waited long enough, so let's close this
- // connection!
- //
- setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
- }
-
- //
- // No return here, we must still wait until close() is
- // called on the _transceiver.
- //
- }
- else
- {
- wait();
- }
- }
-
- assert(_state == StateClosed);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // We wait indefinitely until connection closing has been
+ // initiated. We also wait indefinitely until all outstanding
+ // requests are completed. Otherwise we couldn't guarantee
+ // that there are no outstanding calls when deactivate() is
+ // called on the servant locators.
+ //
+ while(_state < StateClosing || _dispatchCount > 0)
+ {
+ wait();
+ }
+
+ //
+ // Now we must wait until close() has been called on the
+ // transceiver.
+ //
+ while(_transceiver)
+ {
+ if(_state != StateClosed && _endpoint->timeout() >= 0)
+ {
+ IceUtil::Time timeout = IceUtil::Time::milliSeconds(_endpoint->timeout());
+ IceUtil::Time waitTime = _stateTime + timeout - IceUtil::Time::now();
+
+ if(waitTime > IceUtil::Time())
+ {
+ //
+ // We must wait a bit longer until we close this
+ // connection.
+ //
+ if(!timedWait(waitTime))
+ {
+ setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
+ }
+ }
+ else
+ {
+ //
+ // We already waited long enough, so let's close this
+ // connection!
+ //
+ setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
+ }
+
+ //
+ // No return here, we must still wait until close() is
+ // called on the _transceiver.
+ //
+ }
+ else
+ {
+ wait();
+ }
+ }
+
+ assert(_state == StateClosed);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- threadPerConnection = _threadPerConnection;
- _threadPerConnection = 0;
+ threadPerConnection = _threadPerConnection;
+ _threadPerConnection = 0;
#endif
}
#ifndef ICEE_PURE_BLOCKING_CLIENT
if(threadPerConnection)
{
- threadPerConnection->getThreadControl().join();
+ threadPerConnection->getThreadControl().join();
}
#endif
}
@@ -292,194 +292,194 @@ Ice::Connection::sendRequest(BasicStream* os, Outgoing* out)
bool requestSent = false;
try
{
- Lock sendSync(_sendMonitor);
- if(!_transceiver)
- {
- assert(_exception.get());
- //
- // If the connection is closed before we even have a chance
- // to send our request, we always try to send the request
- // again.
- //
- throw LocalExceptionWrapper(*_exception.get(), true);
- }
-
- Int requestId;
- if(out)
- {
- //
- // Create a new unique request ID.
- //
- requestId = _nextRequestId++;
- if(requestId <= 0)
- {
- _nextRequestId = 1;
- requestId = _nextRequestId++;
- }
-
- //
- // Fill in the request ID.
- //
- Byte* dest = &(os->b[0]) + headerSize;
+ Lock sendSync(_sendMonitor);
+ if(!_transceiver)
+ {
+ assert(_exception.get());
+ //
+ // If the connection is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), true);
+ }
+
+ Int requestId;
+ if(out)
+ {
+ //
+ // Create a new unique request ID.
+ //
+ requestId = _nextRequestId++;
+ if(requestId <= 0)
+ {
+ _nextRequestId = 1;
+ requestId = _nextRequestId++;
+ }
+
+ //
+ // Fill in the request ID.
+ //
+ Byte* dest = &(os->b[0]) + headerSize;
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(&requestId) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&requestId) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Byte* src = reinterpret_cast<const Byte*>(&requestId);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&requestId);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(!_blocking)
- {
- _requestsHint = _requests.insert(_requests.end(), pair<const Int, Outgoing*>(requestId, out));
- }
+ if(!_blocking)
+ {
+ _requestsHint = _requests.insert(_requests.end(), pair<const Int, Outgoing*>(requestId, out));
+ }
#endif
- }
+ }
- //
- // Fill in the message size.
- //
- const Int sz = static_cast<Int>(os->b.size());
- Byte* dest = &(os->b[0]) + 10;
+ //
+ // Fill in the message size.
+ //
+ const Int sz = static_cast<Int>(os->b.size());
+ Byte* dest = &(os->b[0]) + 10;
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Byte* src = reinterpret_cast<const Byte*>(&sz);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&sz);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
-
- //
- // Send the request.
- //
- os->i = os->b.begin();
- if(_traceLevels->protocol >= 1)
- {
- traceRequest("sending request", *os, _logger, _traceLevels);
- }
- _transceiver->write(*os);
- requestSent = true;
-
- if(!out)
- {
- return;
- }
-
+
+ //
+ // Send the request.
+ //
+ os->i = os->b.begin();
+ if(_traceLevels->protocol >= 1)
+ {
+ traceRequest("sending request", *os, _logger, _traceLevels);
+ }
+ _transceiver->write(*os);
+ requestSent = true;
+
+ if(!out)
+ {
+ return;
+ }
+
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_blocking)
- {
+ if(_blocking)
+ {
#endif
- //
- // Re-use the stream for reading the reply.
- //
- os->reset();
-
- Int receivedRequestId = 0;
+ //
+ // Re-use the stream for reading the reply.
+ //
+ os->reset();
+
+ Int receivedRequestId = 0;
#ifndef ICEE_PURE_CLIENT
- Int invokeNum = 0;
- readStreamAndParseMessage(*os, receivedRequestId, invokeNum);
- if(invokeNum > 0)
- {
- throwUnknownMessageException(__FILE__, __LINE__);
- }
- else if(requestId != receivedRequestId)
- {
- throwUnknownRequestIdException(__FILE__, __LINE__);
- }
+ Int invokeNum = 0;
+ readStreamAndParseMessage(*os, receivedRequestId, invokeNum);
+ if(invokeNum > 0)
+ {
+ throwUnknownMessageException(__FILE__, __LINE__);
+ }
+ else if(requestId != receivedRequestId)
+ {
+ throwUnknownRequestIdException(__FILE__, __LINE__);
+ }
#else
- readStreamAndParseMessage(*os, receivedRequestId);
- if(requestId != receivedRequestId)
- {
- throwUnknownRequestIdException(__FILE__, __LINE__);
- }
+ readStreamAndParseMessage(*os, receivedRequestId);
+ if(requestId != receivedRequestId)
+ {
+ throwUnknownRequestIdException(__FILE__, __LINE__);
+ }
#endif
- out->finished(*os);
+ out->finished(*os);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- }
- else
- {
- //
- // Wait until the request has completed, or until the request times out.
- //
- Int tout = timeout();
- IceUtil::Time expireTime;
- if(tout > 0)
- {
- expireTime = IceUtil::Time::now() + IceUtil::Time::milliSeconds(tout);
- }
-
- while(out->state() == Outgoing::StateInProgress)
- {
- if(tout > 0)
- {
- IceUtil::Time now = IceUtil::Time::now();
- if(now < expireTime)
- {
- _sendMonitor.timedWait(expireTime - now);
- }
-
- //
- // Make sure we woke up because of timeout and not another response.
- //
- if(out->state() == Outgoing::StateInProgress && IceUtil::Time::now() > expireTime)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
- }
- else
- {
- _sendMonitor.wait();
- }
- }
- }
+ }
+ else
+ {
+ //
+ // Wait until the request has completed, or until the request times out.
+ //
+ Int tout = timeout();
+ IceUtil::Time expireTime;
+ if(tout > 0)
+ {
+ expireTime = IceUtil::Time::now() + IceUtil::Time::milliSeconds(tout);
+ }
+
+ while(out->state() == Outgoing::StateInProgress)
+ {
+ if(tout > 0)
+ {
+ IceUtil::Time now = IceUtil::Time::now();
+ if(now < expireTime)
+ {
+ _sendMonitor.timedWait(expireTime - now);
+ }
+
+ //
+ // Make sure we woke up because of timeout and not another response.
+ //
+ if(out->state() == Outgoing::StateInProgress && IceUtil::Time::now() > expireTime)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+ }
+ else
+ {
+ _sendMonitor.wait();
+ }
+ }
+ }
#endif
}
catch(const LocalException& ex)
{
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- assert(_exception.get());
- if(!requestSent)
- {
- _exception->ice_throw();
- }
- }
-
- //
- // If the request was already sent, we don't throw directly
- // but instead we set the Outgoing object exception with
- // finished(). Throwing directly would break "at-most-once"
- // (see also comment in Outgoing.invoke())
- //
- IceUtil::Monitor<IceUtil::Mutex>::Lock sendSync(_sendMonitor);
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ assert(_exception.get());
+ if(!requestSent)
+ {
+ _exception->ice_throw();
+ }
+ }
+
+ //
+ // If the request was already sent, we don't throw directly
+ // but instead we set the Outgoing object exception with
+ // finished(). Throwing directly would break "at-most-once"
+ // (see also comment in Outgoing.invoke())
+ //
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sendSync(_sendMonitor);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_blocking)
- {
+ if(_blocking)
+ {
#endif
- out->finished(ex);
+ out->finished(ex);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- }
- else
- {
- while(out->state() == Outgoing::StateInProgress)
- {
- _sendMonitor.wait(); // Wait for the thread to propagate the exception to the Outgoing object.
- }
- }
+ }
+ else
+ {
+ while(out->state() == Outgoing::StateInProgress)
+ {
+ _sendMonitor.wait(); // Wait for the thread to propagate the exception to the Outgoing object.
+ }
+ }
#endif
}
}
@@ -496,12 +496,12 @@ Ice::Connection::prepareBatchRequest(BasicStream* os)
//
while(_batchStreamInUse && !_exception.get())
{
- wait();
+ wait();
}
if(_exception.get())
{
- _exception->ice_throw();
+ _exception->ice_throw();
}
assert(_state > StateNotValidated);
@@ -509,15 +509,15 @@ Ice::Connection::prepareBatchRequest(BasicStream* os)
if(_batchStream.b.empty())
{
- try
- {
- _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr));
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- ex.ice_throw();
- }
+ try
+ {
+ _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr));
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ ex.ice_throw();
+ }
}
_batchStreamInUse = true;
@@ -655,111 +655,111 @@ void
Ice::Connection::flushBatchRequestsInternal(bool ignoreInUse)
{
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(!ignoreInUse)
{
- while(_batchStreamInUse && !_exception.get())
- {
- wait();
- }
+ while(_batchStreamInUse && !_exception.get())
+ {
+ wait();
+ }
+ }
+
+ if(_exception.get())
+ {
+ _exception->ice_throw();
}
-
- if(_exception.get())
- {
- _exception->ice_throw();
- }
- if(_batchStream.b.empty())
- {
- return; // Nothing to do.
- }
+ if(_batchStream.b.empty())
+ {
+ return; // Nothing to do.
+ }
- assert(_state > StateNotValidated);
- assert(_state < StateClosing);
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
- _batchStream.i = _batchStream.b.begin();
+ _batchStream.i = _batchStream.b.begin();
- //
- // Prevent that new batch requests are added while we are
- // flushing.
- //
- _batchStreamInUse = true;
+ //
+ // Prevent that new batch requests are added while we are
+ // flushing.
+ //
+ _batchStreamInUse = true;
}
try
{
- Lock sendSync(_sendMonitor);
+ Lock sendSync(_sendMonitor);
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
- //
- // Fill in the number of requests in the batch.
- //
- Byte* dest = &(_batchStream.b[0]) + headerSize;
+ //
+ // Fill in the number of requests in the batch.
+ //
+ Byte* dest = &(_batchStream.b[0]) + headerSize;
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(&_batchRequestNum) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&_batchRequestNum) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Byte* src = reinterpret_cast<const Byte*>(&_batchRequestNum);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&_batchRequestNum);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
-
- const Int sz = static_cast<Int>(_batchStream.b.size());
- dest = &(_batchStream.b[0]) + 10;
+
+ const Int sz = static_cast<Int>(_batchStream.b.size());
+ dest = &(_batchStream.b[0]) + 10;
#ifdef ICE_BIG_ENDIAN
- src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- src = reinterpret_cast<const Byte*>(&sz);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ src = reinterpret_cast<const Byte*>(&sz);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
-
- //
- // Send the batch request.
- //
- _batchStream.i = _batchStream.b.begin();
- if(_traceLevels->protocol >= 1)
- {
- traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
- }
- _transceiver->write(_batchStream);
+
+ //
+ // Send the batch request.
+ //
+ _batchStream.i = _batchStream.b.begin();
+ if(_traceLevels->protocol >= 1)
+ {
+ traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
+ }
+ _transceiver->write(_batchStream);
}
catch(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- assert(_exception.get());
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ assert(_exception.get());
- //
- // Since batch requests are all oneways, we
- // must report the exception to the caller.
- //
- _exception->ice_throw();
+ //
+ // Since batch requests are all oneways, we
+ // must report the exception to the caller.
+ //
+ _exception->ice_throw();
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- //
- // Reset the batch stream, and notify that flushing is over.
- //
+ //
+ // Reset the batch stream, and notify that flushing is over.
+ //
resetBatch(!ignoreInUse);
}
}
@@ -797,69 +797,69 @@ Ice::Connection::sendResponse(BasicStream* os)
{
try
{
- Lock sendSync(_sendMonitor);
+ Lock sendSync(_sendMonitor);
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
- const Int sz = static_cast<Int>(os->b.size());
- Byte* dest = &(os->b[0]) + 10;
+ const Int sz = static_cast<Int>(os->b.size());
+ Byte* dest = &(os->b[0]) + 10;
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Byte* src = reinterpret_cast<const Byte*>(&sz);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&sz);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
-
- //
- // Send the reply.
- //
- os->i = os->b.begin();
- if(_traceLevels->protocol >= 1)
- {
- traceReply("sending reply", *os, _logger, _traceLevels);
- }
- _transceiver->write(*os);
+
+ //
+ // Send the reply.
+ //
+ os->i = os->b.begin();
+ if(_traceLevels->protocol >= 1)
+ {
+ traceReply("sending reply", *os, _logger, _traceLevels);
+ }
+ _transceiver->write(*os);
}
catch(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(_state > StateNotValidated);
+ assert(_state > StateNotValidated);
- try
- {
- assert(_dispatchCount > 0);
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
-
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- }
+ try
+ {
+ assert(_dispatchCount > 0);
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ }
}
}
@@ -872,20 +872,20 @@ Ice::Connection::sendNoResponse()
try
{
- assert(_dispatchCount > 0);
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
+ assert(_dispatchCount > 0);
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
}
catch(const LocalException& ex)
{
- setState(StateClosed, ex);
+ setState(StateClosed, ex);
}
}
@@ -916,12 +916,12 @@ Ice::Connection::setAdapter(const ObjectAdapterPtr& adapter)
//
while(_dispatchCount > 0)
{
- wait();
+ wait();
}
if(_exception.get())
{
- _exception->ice_throw();
+ _exception->ice_throw();
}
assert(_state < StateClosing);
@@ -946,7 +946,7 @@ Ice::Connection::createProxy(const Identity& ident) const
vector<ConnectionPtr> connections;
connections.push_back(const_cast<Connection*>(this));
ReferencePtr ref = _instance->referenceFactory()->create(ident, Ice::Context(), "", ReferenceModeTwoway,
- connections);
+ connections);
return _instance->proxyFactory()->referenceToProxy(ref);
}
@@ -972,28 +972,28 @@ Ice::Connection::toString() const
#ifndef ICEE_PURE_CLIENT
Ice::Connection::Connection(const InstancePtr& instance,
- const TransceiverPtr& transceiver,
- const EndpointPtr& endpoint,
- const ObjectAdapterPtr& adapter) :
+ const TransceiverPtr& transceiver,
+ const EndpointPtr& endpoint,
+ const ObjectAdapterPtr& adapter) :
#else
Ice::Connection::Connection(const InstancePtr& instance,
- const TransceiverPtr& transceiver,
- const EndpointPtr& endpoint) :
+ const TransceiverPtr& transceiver,
+ const EndpointPtr& endpoint) :
#endif
- _instance(instance),
- _transceiver(transceiver),
- _desc(transceiver->toString()),
- _type(transceiver->type()),
- _endpoint(endpoint),
- _logger(_instance->initializationData().logger), // Cached for better performance.
- _traceLevels(_instance->traceLevels()), // Cached for better performance.
- _warn(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Connections") > 0),
+ _instance(instance),
+ _transceiver(transceiver),
+ _desc(transceiver->toString()),
+ _type(transceiver->type()),
+ _endpoint(endpoint),
+ _logger(_instance->initializationData().logger), // Cached for better performance.
+ _traceLevels(_instance->traceLevels()), // Cached for better performance.
+ _warn(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Connections") > 0),
#ifndef ICEE_PURE_CLIENT
- _in(_instance.get(), this, _stream, adapter),
+ _in(_instance.get(), this, _stream, adapter),
#endif
#ifndef ICEE_PURE_BLOCKING_CLIENT
- _stream(_instance.get(), _instance->messageSizeMax()
+ _stream(_instance.get(), _instance->messageSizeMax()
#ifdef ICEE_HAS_WSTRING
, _instance->initializationData().stringConverter, _instance->initializationData().wstringConverter
#endif
@@ -1002,19 +1002,19 @@ Ice::Connection::Connection(const InstancePtr& instance,
#ifdef ICEE_HAS_BATCH
_batchAutoFlush(
_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.BatchAutoFlush", 1) > 0),
- _batchStream(_instance.get(), _instance->messageSizeMax(),
+ _batchStream(_instance.get(), _instance->messageSizeMax(),
#ifdef ICEE_HAS_WSTRING
_instance->initializationData().stringConverter, _instance->initializationData().wstringConverter,
#endif
_batchAutoFlush),
- _batchStreamInUse(false),
- _batchRequestNum(0),
+ _batchStreamInUse(false),
+ _batchRequestNum(0),
_batchMarker(0),
#endif
- _dispatchCount(0),
- _state(StateNotValidated),
- _stateTime(IceUtil::Time::now()),
- _nextRequestId(1)
+ _dispatchCount(0),
+ _state(StateNotValidated),
+ _stateTime(IceUtil::Time::now()),
+ _nextRequestId(1)
#ifndef ICEE_PURE_BLOCKING_CLIENT
, _requestsHint(_requests.end())
#endif
@@ -1027,18 +1027,18 @@ Ice::Connection::Connection(const InstancePtr& instance,
# endif
if(_blocking)
{
- _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout());
+ _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout());
}
else
{
#ifdef _WIN32
- //
- // On Windows, the recv() call doesn't return if the socket is
- // shutdown. We use the timeout to not block indefinitely.
- //
- _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout());
+ //
+ // On Windows, the recv() call doesn't return if the socket is
+ // shutdown. We use the timeout to not block indefinitely.
+ //
+ _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout());
#else
- _transceiver->setTimeouts(-1, _endpoint->timeout());
+ _transceiver->setTimeouts(-1, _endpoint->timeout());
#endif
}
#else
@@ -1050,38 +1050,38 @@ Ice::Connection::Connection(const InstancePtr& instance,
#else
if(_blocking)
{
- validate();
+ validate();
}
else
{
__setNoDelete(true);
try
{
- //
- // If we are in thread per connection mode, create the thread
- // for this connection.
- //
- _threadPerConnection = new ThreadPerConnection(this);
- _threadPerConnection->start(_instance->threadPerConnectionStackSize());
+ //
+ // If we are in thread per connection mode, create the thread
+ // for this connection.
+ //
+ _threadPerConnection = new ThreadPerConnection(this);
+ _threadPerConnection->start(_instance->threadPerConnectionStackSize());
}
catch(const Ice::Exception& ex)
{
- {
- Error out(_logger);
- out << "cannot create thread for connection:\n" << ex.toString();
- }
-
- try
- {
- _transceiver->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
-
- __setNoDelete(false);
- ex.ice_throw();
+ {
+ Error out(_logger);
+ out << "cannot create thread for connection:\n" << ex.toString();
+ }
+
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ __setNoDelete(false);
+ ex.ice_throw();
}
__setNoDelete(false);
}
@@ -1108,25 +1108,25 @@ Ice::Connection::validate()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // The connection might already be closed (e.g.: the communicator
- // was destroyed or object adapter deactivated.)
- //
- assert(_state == StateNotValidated || _state == StateClosed);
- if(_state == StateClosed)
- {
- assert(_exception.get());
- _exception->ice_throw();
- }
+
+ //
+ // The connection might already be closed (e.g.: the communicator
+ // was destroyed or object adapter deactivated.)
+ //
+ assert(_state == StateNotValidated || _state == StateClosed);
+ if(_state == StateClosed)
+ {
+ assert(_exception.get());
+ _exception->ice_throw();
+ }
if(_in.getAdapter())
{
- active = true; // The server side has the active role for connection validation.
+ active = true; // The server side has the active role for connection validation.
}
else
{
- active = false; // The client side has the passive role for connection validation.
+ active = false; // The client side has the passive role for connection validation.
}
}
#endif
@@ -1136,111 +1136,111 @@ Ice::Connection::validate()
Int timeout;
if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
{
- timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
+ timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
}
else
{
- timeout = _endpoint->timeout();
+ timeout = _endpoint->timeout();
}
#ifndef ICEE_PURE_CLIENT
if(active)
{
- BasicStream os(_instance.get(), _instance->messageSizeMax()
+ BasicStream os(_instance.get(), _instance->messageSizeMax()
#ifdef ICEE_HAS_WSTRING
, _instance->initializationData().stringConverter,
_instance->initializationData().wstringConverter
#endif
);
- os.write(magic[0]);
- os.write(magic[1]);
- os.write(magic[2]);
- os.write(magic[3]);
- os.write(protocolMajor);
- os.write(protocolMinor);
- os.write(encodingMajor);
- os.write(encodingMinor);
- os.write(validateConnectionMsg);
- os.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection).
- os.write(headerSize); // Message size.
- os.i = os.b.begin();
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("sending validate connection", os, _logger, _traceLevels);
- }
- try
- {
- _transceiver->writeWithTimeout(os, timeout);
- }
- catch(const TimeoutException&)
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
+ os.write(magic[0]);
+ os.write(magic[1]);
+ os.write(magic[2]);
+ os.write(magic[3]);
+ os.write(protocolMajor);
+ os.write(protocolMinor);
+ os.write(encodingMajor);
+ os.write(encodingMinor);
+ os.write(validateConnectionMsg);
+ os.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection).
+ os.write(headerSize); // Message size.
+ os.i = os.b.begin();
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("sending validate connection", os, _logger, _traceLevels);
+ }
+ try
+ {
+ _transceiver->writeWithTimeout(os, timeout);
+ }
+ catch(const TimeoutException&)
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
}
else
#endif
{
- BasicStream is(_instance.get(), _instance->messageSizeMax()
+ BasicStream is(_instance.get(), _instance->messageSizeMax()
#ifdef ICEE_HAS_WSTRING
, _instance->initializationData().stringConverter,
_instance->initializationData().wstringConverter
#endif
);
- is.b.resize(headerSize);
- is.i = is.b.begin();
- try
- {
- _transceiver->readWithTimeout(is, timeout);
- }
- catch(const TimeoutException&)
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- assert(is.i == is.b.end());
- is.i = is.b.begin();
- Ice::Byte m[4];
- is.read(m[0]);
- is.read(m[1]);
- is.read(m[2]);
- is.read(m[3]);
- if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
- {
- throwBadMagicException(__FILE__, __LINE__, Ice::ByteSeq(&m[0], &m[0] + sizeof(m)));
- }
- Byte pMajor;
- Byte pMinor;
- is.read(pMajor);
- is.read(pMinor);
- if(pMajor != protocolMajor)
- {
- throwUnsupportedProtocolException(__FILE__, __LINE__, pMajor, pMinor, protocolMajor, protocolMinor);
- }
- Byte eMajor;
- Byte eMinor;
- is.read(eMajor);
- is.read(eMinor);
- if(eMajor != encodingMajor)
- {
- throwUnsupportedEncodingException(__FILE__, __LINE__, eMajor, eMinor, encodingMajor, encodingMinor);
- }
- Byte messageType;
- is.read(messageType);
- if(messageType != validateConnectionMsg)
- {
- throwConnectionNotValidatedException(__FILE__, __LINE__);
- }
+ is.b.resize(headerSize);
+ is.i = is.b.begin();
+ try
+ {
+ _transceiver->readWithTimeout(is, timeout);
+ }
+ catch(const TimeoutException&)
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ assert(is.i == is.b.end());
+ is.i = is.b.begin();
+ Ice::Byte m[4];
+ is.read(m[0]);
+ is.read(m[1]);
+ is.read(m[2]);
+ is.read(m[3]);
+ if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
+ {
+ throwBadMagicException(__FILE__, __LINE__, Ice::ByteSeq(&m[0], &m[0] + sizeof(m)));
+ }
+ Byte pMajor;
+ Byte pMinor;
+ is.read(pMajor);
+ is.read(pMinor);
+ if(pMajor != protocolMajor)
+ {
+ throwUnsupportedProtocolException(__FILE__, __LINE__, pMajor, pMinor, protocolMajor, protocolMinor);
+ }
+ Byte eMajor;
+ Byte eMinor;
+ is.read(eMajor);
+ is.read(eMinor);
+ if(eMajor != encodingMajor)
+ {
+ throwUnsupportedEncodingException(__FILE__, __LINE__, eMajor, eMinor, encodingMajor, encodingMinor);
+ }
+ Byte messageType;
+ is.read(messageType);
+ if(messageType != validateConnectionMsg)
+ {
+ throwConnectionNotValidatedException(__FILE__, __LINE__);
+ }
Byte compress;
is.read(compress); // Ignore compression status for validate connection.
- Int size;
- is.read(size);
- if(size != headerSize)
- {
- throwIllegalMessageSizeException(__FILE__, __LINE__);
- }
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("received validate connection", is, _logger, _traceLevels);
- }
+ Int size;
+ is.read(size);
+ if(size != headerSize)
+ {
+ throwIllegalMessageSizeException(__FILE__, __LINE__);
+ }
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("received validate connection", is, _logger, _traceLevels);
+ }
}
}
catch(const LocalException& ex)
@@ -1269,41 +1269,41 @@ Ice::Connection::setState(State state, const LocalException& ex)
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
if(!_exception.get())
{
- //
- // If we are in closed state, an exception must be set.
- //
- assert(_state != StateClosed);
-
- _exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
-
- if(_warn)
- {
- //
- // We don't warn if we are not validated.
- //
- if(_state > StateNotValidated)
- {
- //
- // Don't warn about certain expected exceptions.
- //
- if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
- dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
- dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
+ //
+ // If we are in closed state, an exception must be set.
+ //
+ assert(_state != StateClosed);
+
+ _exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+
+ if(_warn)
+ {
+ //
+ // We don't warn if we are not validated.
+ //
+ if(_state > StateNotValidated)
+ {
+ //
+ // Don't warn about certain expected exceptions.
+ //
+ if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
#ifndef ICEE_PURE_CLIENT
- dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
#endif
- (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state == StateClosing)))
- {
- Warning out(_logger);
- out << "connection exception:\n" << (*_exception.get()).toString() << "\n" << _desc;
- }
- }
- }
+ (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state == StateClosing)))
+ {
+ Warning out(_logger);
+ out << "connection exception:\n" << (*_exception.get()).toString() << "\n" << _desc;
+ }
+ }
+ }
}
//
@@ -1319,91 +1319,91 @@ Ice::Connection::setState(State state)
{
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
switch(state)
{
case StateNotValidated:
{
- assert(false);
- break;
+ assert(false);
+ break;
}
case StateActive:
{
- //
- // Can only switch from holding or not validated to
- // active.
- //
+ //
+ // Can only switch from holding or not validated to
+ // active.
+ //
#ifdef ICEE_PURE_CLIENT
- if(_state != StateNotValidated)
- {
- return;
- }
+ if(_state != StateNotValidated)
+ {
+ return;
+ }
#else
- if(_state != StateHolding && _state != StateNotValidated)
- {
- return;
- }
+ if(_state != StateHolding && _state != StateNotValidated)
+ {
+ return;
+ }
#endif
- break;
+ break;
}
-
+
#ifndef ICEE_PURE_CLIENT
case StateHolding:
{
- //
- // Can only switch from active or not validated to
- // holding.
- //
- if(_state != StateActive && _state != StateNotValidated)
- {
- return;
- }
- break;
+ //
+ // Can only switch from active or not validated to
+ // holding.
+ //
+ if(_state != StateActive && _state != StateNotValidated)
+ {
+ return;
+ }
+ break;
}
#endif
case StateClosing:
{
- //
- // Can't change back from closed.
- //
- if(_state == StateClosed)
- {
- return;
- }
- break;
+ //
+ // Can't change back from closed.
+ //
+ if(_state == StateClosed)
+ {
+ return;
+ }
+ break;
}
-
+
case StateClosed:
{
- //
- // We shutdown both for reading and writing. This will
- // unblock and read call with an exception. The thread
- // per connection then closes the transceiver.
- //
- _transceiver->shutdownReadWrite();
+ //
+ // We shutdown both for reading and writing. This will
+ // unblock and read call with an exception. The thread
+ // per connection then closes the transceiver.
+ //
+ _transceiver->shutdownReadWrite();
- //
- // In blocking mode, we close the transceiver now.
- //
+ //
+ // In blocking mode, we close the transceiver now.
+ //
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_blocking)
+ if(_blocking)
#endif
- {
- Lock sync(_sendMonitor);
- try
- {
- _transceiver->close();
- }
- catch(const Ice::LocalException&)
- {
- }
- _transceiver = 0;
- }
- break;
+ {
+ Lock sync(_sendMonitor);
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
+ _transceiver = 0;
+ }
+ break;
}
}
@@ -1414,21 +1414,21 @@ Ice::Connection::setState(State state)
if(_state == StateClosing && _dispatchCount == 0)
{
- try
- {
- initiateShutdown();
+ try
+ {
+ initiateShutdown();
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_blocking)
+ if(_blocking)
#endif
- {
- setState(StateClosed);
- }
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- }
+ {
+ setState(StateClosed);
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ }
}
}
@@ -1467,7 +1467,7 @@ Ice::Connection::initiateShutdown() const
os.i = os.b.begin();
if(_traceLevels->protocol >= 1)
{
- traceHeader("sending close connection", os, _logger, _traceLevels);
+ traceHeader("sending close connection", os, _logger, _traceLevels);
}
_transceiver->write(os);
@@ -1503,20 +1503,20 @@ Ice::Connection::readStreamAndParseMessage(IceInternal::BasicStream& stream, Int
stream.readBlob(header, headerSize);
if(header[0] != magic[0] || header[1] != magic[1] || header[2] != magic[2] || header[3] != magic[3])
{
- throwBadMagicException(__FILE__, __LINE__, Ice::ByteSeq(&header[0], &header[0] + sizeof(magic)));
+ throwBadMagicException(__FILE__, __LINE__, Ice::ByteSeq(&header[0], &header[0] + sizeof(magic)));
}
if(header[4] != protocolMajor)
{
- throwUnsupportedProtocolException(__FILE__, __LINE__, header[4], header[5], protocolMajor, protocolMinor);
+ throwUnsupportedProtocolException(__FILE__, __LINE__, header[4], header[5], protocolMajor, protocolMinor);
}
if(header[6] != encodingMajor)
{
- throwUnsupportedEncodingException(__FILE__, __LINE__, header[6], header[7], encodingMajor, encodingMinor);
+ throwUnsupportedEncodingException(__FILE__, __LINE__, header[6], header[7], encodingMajor, encodingMinor);
}
const Byte messageType = header[8];
if(header[9] == 2)
{
- throw FeatureNotSupportedException(__FILE__, __LINE__, "compression");
+ throw FeatureNotSupportedException(__FILE__, __LINE__, "compression");
}
Int size;
@@ -1524,21 +1524,21 @@ Ice::Connection::readStreamAndParseMessage(IceInternal::BasicStream& stream, Int
stream.read(size);
if(size < headerSize)
{
- throwIllegalMessageSizeException(__FILE__, __LINE__);
+ throwIllegalMessageSizeException(__FILE__, __LINE__);
}
if(size > static_cast<Int>(_instance->messageSizeMax()))
{
- throwMemoryLimitException(__FILE__, __LINE__);
+ throwMemoryLimitException(__FILE__, __LINE__);
}
if(size > static_cast<Int>(stream.b.size()))
{
- stream.b.resize(size);
+ stream.b.resize(size);
}
stream.i = stream.b.begin() + pos;
if(stream.i != stream.b.end())
{
- _transceiver->read(stream);
+ _transceiver->read(stream);
}
assert(stream.i == stream.b.end());
@@ -1548,74 +1548,74 @@ Ice::Connection::readStreamAndParseMessage(IceInternal::BasicStream& stream, Int
{
case closeConnectionMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("received close connection", stream, _logger, _traceLevels);
- }
- throw CloseConnectionException(__FILE__, __LINE__);
- break;
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("received close connection", stream, _logger, _traceLevels);
+ }
+ throw CloseConnectionException(__FILE__, __LINE__);
+ break;
}
-
+
case replyMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceReply("received reply", stream, _logger, _traceLevels);
- }
- stream.read(requestId);
- break;
- }
-
+ if(_traceLevels->protocol >= 1)
+ {
+ traceReply("received reply", stream, _logger, _traceLevels);
+ }
+ stream.read(requestId);
+ break;
+ }
+
#ifndef ICEE_PURE_CLIENT
case requestMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceRequest("received request", stream, _logger, _traceLevels);
- }
- stream.read(requestId);
- invokeNum = 1;
- break;
+ if(_traceLevels->protocol >= 1)
+ {
+ traceRequest("received request", stream, _logger, _traceLevels);
+ }
+ stream.read(requestId);
+ invokeNum = 1;
+ break;
}
-
+
case requestBatchMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceBatchRequest("received batch request", stream, _logger, _traceLevels);
- }
- stream.read(invokeNum);
- if(invokeNum < 0)
- {
- invokeNum = 0;
- throwNegativeSizeException(__FILE__, __LINE__);
- }
- break;
+ if(_traceLevels->protocol >= 1)
+ {
+ traceBatchRequest("received batch request", stream, _logger, _traceLevels);
+ }
+ stream.read(invokeNum);
+ if(invokeNum < 0)
+ {
+ invokeNum = 0;
+ throwNegativeSizeException(__FILE__, __LINE__);
+ }
+ break;
}
#endif
-
+
case validateConnectionMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("received validate connection", stream, _logger, _traceLevels);
- }
- if(_warn)
- {
- Warning out(_logger);
- out << "ignoring unexpected validate connection message:\n" << _desc;
- }
- break;
- }
-
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("received validate connection", stream, _logger, _traceLevels);
+ }
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "ignoring unexpected validate connection message:\n" << _desc;
+ }
+ break;
+ }
+
default:
{
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("received unknown message\n(invalid, closing connection)", stream, _logger, _traceLevels);
- }
- throwUnknownMessageException(__FILE__, __LINE__);
- break;
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("received unknown message\n(invalid, closing connection)", stream, _logger, _traceLevels);
+ }
+ throwUnknownMessageException(__FILE__, __LINE__);
+ break;
}
}
}
@@ -1636,17 +1636,17 @@ Ice::Connection::run()
}
catch(const LocalException&)
{
- Lock sync(*this);
+ Lock sync(*this);
assert(_state == StateClosed);
- Lock sendSync(_sendMonitor);
+ Lock sendSync(_sendMonitor);
try
{
- _transceiver->close();
+ _transceiver->close();
}
catch(const LocalException&)
{
- // Here we ignore any exceptions in close().
+ // Here we ignore any exceptions in close().
}
_transceiver = 0;
@@ -1660,224 +1660,224 @@ Ice::Connection::run()
while(!closed)
{
- Int requestId = 0;
+ Int requestId = 0;
#ifndef ICEE_PURE_CLIENT
- Int invokeNum = 0;
- _in.os()->reset();
+ Int invokeNum = 0;
+ _in.os()->reset();
#endif
- _stream.reset();
-
- //
- // Read and parse the next message. We don't need to lock the
- // send monitor here as we have the guarantee that
- // _transceiver won't be set to 0 by another thread, the
- // thread per connection is the only thread that can set
- // _transceiver to 0.
- //
- try
- {
+ _stream.reset();
+
+ //
+ // Read and parse the next message. We don't need to lock the
+ // send monitor here as we have the guarantee that
+ // _transceiver won't be set to 0 by another thread, the
+ // thread per connection is the only thread that can set
+ // _transceiver to 0.
+ //
+ try
+ {
#ifndef ICEE_PURE_CLIENT
- readStreamAndParseMessage(_stream, requestId, invokeNum);
+ readStreamAndParseMessage(_stream, requestId, invokeNum);
#else
- readStreamAndParseMessage(_stream, requestId);
+ readStreamAndParseMessage(_stream, requestId);
#endif
- }
+ }
#ifdef _WIN32
- catch(const Ice::TimeoutException&)
- {
- //
- // See the comment in the Connection constructor. This is
- // necessary to not block in recv() indefinitely.
- //
- continue;
- }
+ catch(const Ice::TimeoutException&)
+ {
+ //
+ // See the comment in the Connection constructor. This is
+ // necessary to not block in recv() indefinitely.
+ //
+ continue;
+ }
#endif
- catch(const Ice::LocalException& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- }
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(_state != StateClosed)
- {
+ catch(const Ice::LocalException& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ }
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ if(_state != StateClosed)
+ {
#ifndef ICEE_PURE_CLIENT
- if(invokeNum > 0) // We received a request or a batch request
- {
- if(_state == StateClosing)
- {
- if(_traceLevels->protocol >= 1)
- {
- string req = invokeNum > 1 ? "received batch request" : "received request";
- req += " during closing\n(ignored by server, client will retry)";
- traceRequest( req.c_str(), _stream, _logger, _traceLevels);
- }
- invokeNum = 0;
- }
- _dispatchCount += invokeNum;
- }
- else
+ if(invokeNum > 0) // We received a request or a batch request
+ {
+ if(_state == StateClosing)
+ {
+ if(_traceLevels->protocol >= 1)
+ {
+ string req = invokeNum > 1 ? "received batch request" : "received request";
+ req += " during closing\n(ignored by server, client will retry)";
+ traceRequest( req.c_str(), _stream, _logger, _traceLevels);
+ }
+ invokeNum = 0;
+ }
+ _dispatchCount += invokeNum;
+ }
+ else
#endif
- if(requestId > 0)
- {
- //
- // The message is a reply, we search the Outgoing object waiting
- // for this reply and pass it the stream before to notify the
- // send monitor to wake up threads waiting for replies.
- //
- try
- {
- Lock sync(_sendMonitor);
-
- map<Int, Outgoing*>::iterator p = _requests.end();
- if(p != _requestsHint)
- {
- if(_requestsHint->first == requestId)
- {
- p = _requestsHint;
- }
- }
-
- if(p == _requests.end())
- {
- p = _requests.find(requestId);
- }
-
- if(p == _requests.end())
- {
- throwUnknownRequestIdException(__FILE__, __LINE__);
- }
-
- p->second->finished(_stream);
-
- if(p == _requestsHint)
- {
- _requests.erase(p++);
- _requestsHint = p;
- }
- else
- {
- _requests.erase(p);
- }
- _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
- }
- catch(const Ice::LocalException& ex)
- {
- setState(StateClosed, ex);
- }
- }
- }
+ if(requestId > 0)
+ {
+ //
+ // The message is a reply, we search the Outgoing object waiting
+ // for this reply and pass it the stream before to notify the
+ // send monitor to wake up threads waiting for replies.
+ //
+ try
+ {
+ Lock sync(_sendMonitor);
+
+ map<Int, Outgoing*>::iterator p = _requests.end();
+ if(p != _requestsHint)
+ {
+ if(_requestsHint->first == requestId)
+ {
+ p = _requestsHint;
+ }
+ }
+
+ if(p == _requests.end())
+ {
+ p = _requests.find(requestId);
+ }
+
+ if(p == _requests.end())
+ {
+ throwUnknownRequestIdException(__FILE__, __LINE__);
+ }
+
+ p->second->finished(_stream);
+
+ if(p == _requestsHint)
+ {
+ _requests.erase(p++);
+ _requestsHint = p;
+ }
+ else
+ {
+ _requests.erase(p);
+ }
+ _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+ }
#ifndef ICEE_PURE_CLIENT
- while(_state == StateHolding)
- {
- wait();
- }
+ while(_state == StateHolding)
+ {
+ wait();
+ }
#endif
- if(_state == StateClosed)
- {
- Lock sync(_sendMonitor);
- try
- {
- _transceiver->close();
- }
- catch(const LocalException&)
- {
- }
- _transceiver = 0;
- notifyAll();
-
- //
- // We cannot simply return here. We have to make sure
- // that all requests are notified about the closed
- // connection below.
- //
- closed = true;
- }
-
- if(_state == StateClosed || _state == StateClosing)
- {
- Lock sync(_sendMonitor);
- assert(_exception.get());
- for(map<Int, Outgoing*>::iterator p = _requests.begin(); p != _requests.end(); ++p)
- {
- p->second->finished(*_exception.get()); // The exception is immutable at this point.
- }
- _requests.clear();
- _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
- }
- }
-
- //
- // Method invocation (or multiple invocations for batch
- // messages) must be done outside the thread synchronization,
- // so that nested calls are possible.
- //
+ if(_state == StateClosed)
+ {
+ Lock sync(_sendMonitor);
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ }
+ _transceiver = 0;
+ notifyAll();
+
+ //
+ // We cannot simply return here. We have to make sure
+ // that all requests are notified about the closed
+ // connection below.
+ //
+ closed = true;
+ }
+
+ if(_state == StateClosed || _state == StateClosing)
+ {
+ Lock sync(_sendMonitor);
+ assert(_exception.get());
+ for(map<Int, Outgoing*>::iterator p = _requests.begin(); p != _requests.end(); ++p)
+ {
+ p->second->finished(*_exception.get()); // The exception is immutable at this point.
+ }
+ _requests.clear();
+ _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
+ }
+ }
+
+ //
+ // Method invocation (or multiple invocations for batch
+ // messages) must be done outside the thread synchronization,
+ // so that nested calls are possible.
+ //
#ifndef ICEE_PURE_CLIENT
- try
- {
- for(;invokeNum > 0; --invokeNum)
- {
- //
- // Prepare the response if necessary.
- //
- const bool response = requestId != 0;
- if(response)
- {
- assert(invokeNum == 1); // No further invocations if a response is expected.
-
- //
- // Add the reply header and request id.
- //
- BasicStream* os = _in.os();
- os->writeBlob(replyHdr, sizeof(replyHdr));
- os->write(requestId);
- }
-
- //
- // Dispatch the incoming request.
- //
- _in.invoke(response, requestId);
- }
- }
- catch(const LocalException& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- }
- catch(const std::exception& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = string("std::exception: ") + ex.what();
- setState(StateClosed, uex);
- }
- catch(...)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = "unknown c++ exception";
- setState(StateClosed, uex);
- }
-
- //
- // If invoke() above raised an exception, and therefore neither
- // sendResponse() nor sendNoResponse() has been called, then we
- // must decrement _dispatchCount here.
- //
- if(invokeNum > 0)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(_dispatchCount > 0);
- _dispatchCount -= invokeNum;
- assert(_dispatchCount >= 0);
- if(_dispatchCount == 0)
- {
- notifyAll();
- }
- }
+ try
+ {
+ for(;invokeNum > 0; --invokeNum)
+ {
+ //
+ // Prepare the response if necessary.
+ //
+ const bool response = requestId != 0;
+ if(response)
+ {
+ assert(invokeNum == 1); // No further invocations if a response is expected.
+
+ //
+ // Add the reply header and request id.
+ //
+ BasicStream* os = _in.os();
+ os->writeBlob(replyHdr, sizeof(replyHdr));
+ os->write(requestId);
+ }
+
+ //
+ // Dispatch the incoming request.
+ //
+ _in.invoke(response, requestId);
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ }
+ catch(const std::exception& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ UnknownException uex(__FILE__, __LINE__);
+ uex.unknown = string("std::exception: ") + ex.what();
+ setState(StateClosed, uex);
+ }
+ catch(...)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ UnknownException uex(__FILE__, __LINE__);
+ uex.unknown = "unknown c++ exception";
+ setState(StateClosed, uex);
+ }
+
+ //
+ // If invoke() above raised an exception, and therefore neither
+ // sendResponse() nor sendNoResponse() has been called, then we
+ // must decrement _dispatchCount here.
+ //
+ if(invokeNum > 0)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(_dispatchCount > 0);
+ _dispatchCount -= invokeNum;
+ assert(_dispatchCount >= 0);
+ if(_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+ }
#endif
}
}
@@ -1892,22 +1892,22 @@ Ice::Connection::ThreadPerConnection::run()
{
try
{
- _connection->run();
+ _connection->run();
}
catch(const Exception& ex)
- {
- Error out(_connection->_logger);
- out << "exception in thread per connection:\n" << _connection->toString() << ex.toString();
+ {
+ Error out(_connection->_logger);
+ out << "exception in thread per connection:\n" << _connection->toString() << ex.toString();
}
catch(const std::exception& ex)
{
- Error out(_connection->_logger);
- out << "std::exception in thread per connection:\n" << _connection->toString() << ex.what();
+ Error out(_connection->_logger);
+ out << "std::exception in thread per connection:\n" << _connection->toString() << ex.what();
}
catch(...)
{
- Error out(_connection->_logger);
- out << "unknown exception in thread per connection:\n" << _connection->toString();
+ Error out(_connection->_logger);
+ out << "unknown exception in thread per connection:\n" << _connection->toString();
}
_connection = 0; // Resolve cyclic dependency.
diff --git a/cppe/src/IceE/ConvertUTF.cpp b/cppe/src/IceE/ConvertUTF.cpp
index 7575bcc5c86..ea3812228b2 100644
--- a/cppe/src/IceE/ConvertUTF.cpp
+++ b/cppe/src/IceE/ConvertUTF.cpp
@@ -39,10 +39,10 @@
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
Sept 2001: fixed const & error conditions per
- mods suggested by S. Parent & A. Lillich.
+ mods suggested by S. Parent & A. Lillich.
June 2002: Tim Dodd added detection and handling of incomplete
- source sequences, enhanced error detection, added casts
- to eliminate compiler warnings.
+ source sequences, enhanced error detection, added casts
+ to eliminate compiler warnings.
July 2003: slight mods to back out aggressive FFFE detection.
Jan 2004: updated switches in from-UTF8 conversions.
Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
@@ -70,8 +70,8 @@ static const UTF32 halfMask = 0x3FFUL;
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
#define UNI_SUR_LOW_START (UTF32)0xDC00
#define UNI_SUR_LOW_END (UTF32)0xDFFF
-// #define false 0
-// #define true 1
+// #define false 0
+// #define true 1
/* --------------------------------------------------------------------- */
@@ -100,7 +100,7 @@ static const char trailingBytesForUTF8[256] = {
* in a UTF-8 sequence.
*/
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
- 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
+ 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
/*
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
@@ -124,67 +124,67 @@ static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF16toUTF8 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF16* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
- ch = *source++;
- /* If we have a surrogate pair, convert to UTF32 first. */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
- /* If the 16 bits following the high surrogate are in the source buffer... */
- if (source < sourceEnd) {
- UTF32 ch2 = *source;
- /* If it's a low surrogate, convert to UTF32. */
- if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
- ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
- + (ch2 - UNI_SUR_LOW_START) + halfBase;
- ++source;
- } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- } else { /* We don't have the 16 bits following the high surrogate. */
- --source; /* return to the high surrogate */
- result = sourceExhausted;
- break;
- }
- } else if (flags == strictConversion) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /* Figure out how many bytes the result will require */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- source = oldSource; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ UTF32 ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /* Figure out how many bytes the result will require */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
@@ -209,19 +209,19 @@ static Boolean isLegalUTF8(const UTF8 *source, int length) {
const UTF8 *srcptr = source+length;
switch (length) {
default: return false;
- /* Everything else falls through when "true"... */
+ /* Everything else falls through when "true"... */
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 2: if ((a = (*--srcptr)) > 0xBF) return false;
- switch (*source) {
- /* no fall-through in this inner switch */
- case 0xE0: if (a < 0xA0) return false; break;
- case 0xED: if (a > 0x9F) return false; break;
- case 0xF0: if (a < 0x90) return false; break;
- case 0xF4: if (a > 0x8F) return false; break;
- default: if (a < 0x80) return false;
- }
+ switch (*source) {
+ /* no fall-through in this inner switch */
+ case 0xE0: if (a < 0xA0) return false; break;
+ case 0xED: if (a > 0x9F) return false; break;
+ case 0xF0: if (a < 0x90) return false; break;
+ case 0xF4: if (a > 0x8F) return false; break;
+ default: if (a < 0x80) return false;
+ }
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
}
@@ -260,70 +260,70 @@ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF16 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF16* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (! isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = (UTF16)ch; /* normal case */
- }
- } else if (ch > UNI_MAX_UTF16) {
- if (flags == strictConversion) {
- result = sourceIllegal;
- source -= (extraBytesToRead+1); /* return to the start */
- break; /* Bail out; shouldn't continue */
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- /* target is a character in range 0xFFFF - 0x10FFFF. */
- if (target + 1 >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- ch -= halfBase;
- *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
- *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
- }
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_UTF16) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ source -= (extraBytesToRead+1); /* return to the start */
+ break; /* Bail out; shouldn't continue */
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -333,50 +333,50 @@ ConversionResult ConvertUTF8toUTF16 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF32toUTF8 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF32* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- ch = *source++;
- if (flags == strictConversion ) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /*
- * Figure out how many bytes the result will require. Turn any
- * illegally large UTF32 things (> Plane 17) into replacement chars.
- */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- result = sourceIllegal;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- --source; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ ch = *source++;
+ if (flags == strictConversion ) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /*
+ * Figure out how many bytes the result will require. Turn any
+ * illegally large UTF32 things (> Plane 17) into replacement chars.
+ */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ result = sourceIllegal;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ --source; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
@@ -386,59 +386,59 @@ ConversionResult ConvertUTF32toUTF8 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF32 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF32* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (! isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6;
- case 4: ch += *source++; ch <<= 6;
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up the source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_LEGAL_UTF32) {
- /*
- * UTF-16 surrogate values are illegal in UTF-32, and anything
- * over Plane 17 (> 0x10FFFF) is illegal.
- */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = ch;
- }
- } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
- result = sourceIllegal;
- *target++ = UNI_REPLACEMENT_CHAR;
- }
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6;
+ case 4: ch += *source++; ch <<= 6;
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up the source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_LEGAL_UTF32) {
+ /*
+ * UTF-16 surrogate values are illegal in UTF-32, and anything
+ * over Plane 17 (> 0x10FFFF) is illegal.
+ */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = ch;
+ }
+ } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
+ result = sourceIllegal;
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -451,14 +451,14 @@ ConversionResult ConvertUTF8toUTF32 (
The fall-through switches in UTF-8 reading code save a
temp variable, some decrements & conditionals. The switches
are equivalent to the following loop:
- {
- int tmpBytesToRead = extraBytesToRead+1;
- do {
- ch += *source++;
- --tmpBytesToRead;
- if (tmpBytesToRead) ch <<= 6;
- } while (tmpBytesToRead > 0);
- }
+ {
+ int tmpBytesToRead = extraBytesToRead+1;
+ do {
+ ch += *source++;
+ --tmpBytesToRead;
+ if (tmpBytesToRead) ch <<= 6;
+ } while (tmpBytesToRead > 0);
+ }
In UTF-8 writing code, the switches on "bytesToWrite" are
similarly unrolled loops.
diff --git a/cppe/src/IceE/ConvertUTF.h b/cppe/src/IceE/ConvertUTF.h
index 92f461a91e5..07e2c0afcd8 100644
--- a/cppe/src/IceE/ConvertUTF.h
+++ b/cppe/src/IceE/ConvertUTF.h
@@ -62,12 +62,12 @@
the respective buffers.
Input parameters:
- sourceStart - pointer to a pointer to the source buffer.
- The contents of this are modified on return so that
- it points at the next thing to be converted.
- targetStart - similarly, pointer to pointer to the target buffer.
- sourceEnd, targetEnd - respectively pointers to the ends of the
- two buffers, for overflow checking only.
+ sourceStart - pointer to a pointer to the source buffer.
+ The contents of this are modified on return so that
+ it points at the next thing to be converted.
+ targetStart - similarly, pointer to pointer to the target buffer.
+ sourceEnd, targetEnd - respectively pointers to the ends of the
+ two buffers, for overflow checking only.
These conversion functions take a ConversionFlags argument. When this
flag is set to strict, both irregular sequences and isolated surrogates
@@ -84,15 +84,15 @@
they constitute an error.
Output parameters:
- The value "sourceIllegal" is returned from some routines if the input
- sequence is malformed. When "sourceIllegal" is returned, the source
- value will point to the illegal value that caused the problem. E.g.,
- in UTF-8 when a sequence is malformed, it points to the start of the
- malformed sequence.
+ The value "sourceIllegal" is returned from some routines if the input
+ sequence is malformed. When "sourceIllegal" is returned, the source
+ value will point to the illegal value that caused the problem. E.g.,
+ in UTF-8 when a sequence is malformed, it points to the start of the
+ malformed sequence.
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
- Fixes & updates, Sept 2001.
+ Fixes & updates, Sept 2001.
------------------------------------------------------------------------ */
@@ -107,10 +107,10 @@
namespace IceUtil
{
-typedef unsigned int UTF32; /* at least 32 bits */
-typedef unsigned short UTF16; /* at least 16 bits */
-typedef unsigned char UTF8; /* typically 8 bits */
-typedef bool Boolean; /* 0 or 1 */
+typedef unsigned int UTF32; /* at least 32 bits */
+typedef unsigned short UTF16; /* at least 16 bits */
+typedef unsigned char UTF8; /* typically 8 bits */
+typedef bool Boolean; /* 0 or 1 */
/* Some fundamental constants */
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
@@ -127,7 +127,7 @@ ConversionResult ConvertUTF8toUTF16(
ConversionResult ConvertUTF16toUTF8 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
+
ConversionResult ConvertUTF8toUTF32(
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
diff --git a/cppe/src/IceE/Current.cpp b/cppe/src/IceE/Current.cpp
index 9b5543f9e39..0ae5348eefb 100644
--- a/cppe/src/IceE/Current.cpp
+++ b/cppe/src/IceE/Current.cpp
@@ -20,35 +20,35 @@ Ice::Current::operator!=(const Current& __rhs) const
{
if(this == &__rhs)
{
- return false;
+ return false;
}
if(adapter != __rhs.adapter)
{
- return true;
+ return true;
}
if(con != __rhs.con)
{
- return true;
+ return true;
}
if(id != __rhs.id)
{
- return true;
+ return true;
}
if(facet != __rhs.facet)
{
- return true;
+ return true;
}
if(operation != __rhs.operation)
{
- return true;
+ return true;
}
if(mode != __rhs.mode)
{
- return true;
+ return true;
}
if(ctx != __rhs.ctx)
{
- return true;
+ return true;
}
return false;
}
@@ -58,63 +58,63 @@ Ice::Current::operator<(const Current& __rhs) const
{
if(this == &__rhs)
{
- return false;
+ return false;
}
if(adapter < __rhs.adapter)
{
- return true;
+ return true;
}
else if(__rhs.adapter < adapter)
{
- return false;
+ return false;
}
if(con < __rhs.con)
{
- return true;
+ return true;
}
else if(__rhs.con < con)
{
- return false;
+ return false;
}
if(id < __rhs.id)
{
- return true;
+ return true;
}
else if(__rhs.id < id)
{
- return false;
+ return false;
}
if(facet < __rhs.facet)
{
- return true;
+ return true;
}
else if(__rhs.facet < facet)
{
- return false;
+ return false;
}
if(operation < __rhs.operation)
{
- return true;
+ return true;
}
else if(__rhs.operation < operation)
{
- return false;
+ return false;
}
if(mode < __rhs.mode)
{
- return true;
+ return true;
}
else if(__rhs.mode < mode)
{
- return false;
+ return false;
}
if(ctx < __rhs.ctx)
{
- return true;
+ return true;
}
else if(__rhs.ctx < ctx)
{
- return false;
+ return false;
}
return false;
}
diff --git a/cppe/src/IceE/DefaultsAndOverrides.cpp b/cppe/src/IceE/DefaultsAndOverrides.cpp
index 1f1a2e6f75c..7b47da40d5c 100644
--- a/cppe/src/IceE/DefaultsAndOverrides.cpp
+++ b/cppe/src/IceE/DefaultsAndOverrides.cpp
@@ -34,15 +34,15 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro
value = properties->getProperty("Ice.Override.Timeout");
if(!value.empty())
{
- const_cast<bool&>(overrideTimeout) = true;
- const_cast<Int&>(overrideTimeoutValue) = properties->getPropertyAsInt("Ice.Override.Timeout");
+ const_cast<bool&>(overrideTimeout) = true;
+ const_cast<Int&>(overrideTimeoutValue) = properties->getPropertyAsInt("Ice.Override.Timeout");
}
value = properties->getProperty("Ice.Override.ConnectTimeout");
if(!value.empty())
{
- const_cast<bool&>(overrideConnectTimeout) = true;
- const_cast<Int&>(overrideConnectTimeoutValue) = properties->getPropertyAsInt("Ice.Override.ConnectTimeout");
+ const_cast<bool&>(overrideConnectTimeout) = true;
+ const_cast<Int&>(overrideConnectTimeoutValue) = properties->getPropertyAsInt("Ice.Override.ConnectTimeout");
}
#ifdef ICEE_HAS_LOCATOR
diff --git a/cppe/src/IceE/ExceptionBase.cpp b/cppe/src/IceE/ExceptionBase.cpp
index 1396a516f3a..83467e3a8a5 100644
--- a/cppe/src/IceE/ExceptionBase.cpp
+++ b/cppe/src/IceE/ExceptionBase.cpp
@@ -99,12 +99,12 @@ IceUtil::NullHandleException::NullHandleException(const char* file, int line) :
if(nullHandleAbort)
{
#ifdef _WIN32_WCE
- //
- // WinCE does not appear to have abort()
- //
- exit(-1);
+ //
+ // WinCE does not appear to have abort()
+ //
+ exit(-1);
#else
- abort();
+ abort();
#endif
}
}
diff --git a/cppe/src/IceE/FactoryTableDef.cpp b/cppe/src/IceE/FactoryTableDef.cpp
index db0ffdfbb8d..127312d6b53 100644
--- a/cppe/src/IceE/FactoryTableDef.cpp
+++ b/cppe/src/IceE/FactoryTableDef.cpp
@@ -17,11 +17,11 @@
namespace IceInternal
{
-FactoryTableWrapper factoryTableWrapper; // Single global instance of the wrapper object that
- // initializes factoryTable.
+FactoryTableWrapper factoryTableWrapper; // Single global instance of the wrapper object that
+ // initializes factoryTable.
-ICE_API FactoryTableDef* factoryTable; // Single global instance of the factory table for
- // non-local exceptions and non-abstract classes
+ICE_API FactoryTableDef* factoryTable; // Single global instance of the factory table for
+ // non-local exceptions and non-abstract classes
}
//
@@ -35,11 +35,11 @@ IceInternal::FactoryTableDef::addExceptionFactory(const std::string& t, const Ic
EFTable::iterator i = _eft.find(t);
if(i == _eft.end())
{
- _eft[t] = EFPair(f, 1);
+ _eft[t] = EFPair(f, 1);
}
else
{
- i->second.second++;
+ i->second.second++;
}
}
@@ -54,23 +54,23 @@ IceInternal::FactoryTableDef::getExceptionFactory(const std::string& t) const
#ifdef __APPLE__
if(i == _eft.end())
{
- lock.release();
-
- //
- // Try to find the symbol, if found this should trigger the
- // object static constructors to be called.
- //
- std::string symbol = "__F";
- for(std::string::const_iterator p = t.begin(); p != t.end(); ++p)
- {
- symbol += ((*p) == ':') ? '_' : *p;
- }
- symbol += "__initializer";
- dlsym(RTLD_DEFAULT, symbol.c_str());
-
- lock.acquire();
-
- i = _eft.find(t);
+ lock.release();
+
+ //
+ // Try to find the symbol, if found this should trigger the
+ // object static constructors to be called.
+ //
+ std::string symbol = "__F";
+ for(std::string::const_iterator p = t.begin(); p != t.end(); ++p)
+ {
+ symbol += ((*p) == ':') ? '_' : *p;
+ }
+ symbol += "__initializer";
+ dlsym(RTLD_DEFAULT, symbol.c_str());
+
+ lock.acquire();
+
+ i = _eft.find(t);
}
#endif
return i != _eft.end() ? i->second.first : IceInternal::UserExceptionFactoryPtr();
@@ -89,10 +89,10 @@ IceInternal::FactoryTableDef::removeExceptionFactory(const std::string& t)
EFTable::iterator i = _eft.find(t);
if(i != _eft.end())
{
- if(--i->second.second == 0)
- {
- _eft.erase(i);
- }
+ if(--i->second.second == 0)
+ {
+ _eft.erase(i);
+ }
}
}
@@ -122,7 +122,7 @@ IceInternal::FactoryTableWrapper::initialize()
IceUtil::StaticMutex::Lock lock(_m);
if(_initCount == 0)
{
- factoryTable = new FactoryTableDef;
+ factoryTable = new FactoryTableDef;
}
++_initCount;
}
@@ -136,9 +136,9 @@ IceInternal::FactoryTableWrapper::finalize()
IceUtil::StaticMutex::Lock lock(_m);
if(--_initCount == 0)
{
- delete factoryTable;
+ delete factoryTable;
}
}
IceUtil::StaticMutex IceInternal::FactoryTableWrapper::_m = ICE_STATIC_MUTEX_INITIALIZER;
-int IceInternal::FactoryTableWrapper::_initCount = 0; // Initialization count
+int IceInternal::FactoryTableWrapper::_initCount = 0; // Initialization count
diff --git a/cppe/src/IceE/Incoming.cpp b/cppe/src/IceE/Incoming.cpp
index 4f5dbb63848..3ea3984b4bf 100644
--- a/cppe/src/IceE/Incoming.cpp
+++ b/cppe/src/IceE/Incoming.cpp
@@ -45,15 +45,15 @@ IceInternal::Incoming::setAdapter(const Ice::ObjectAdapterPtr& adapter)
_adapter = adapter;
if(_adapter)
{
- _servantManager = _adapter->getServantManager().get();
- if(!_servantManager)
- {
- _adapter = 0;
- }
+ _servantManager = _adapter->getServantManager().get();
+ if(!_servantManager)
+ {
+ _adapter = 0;
+ }
}
else
{
- _servantManager = 0;
+ _servantManager = 0;
}
}
@@ -85,26 +85,26 @@ IceInternal::Incoming::invoke(bool response, Int requestId)
// string facet;
// if(!facetPath.empty())
// {
-// if(facetPath.size() > 1)
-// {
-// throw MarshalException(__FILE__, __LINE__);
-// }
-// facet.swap(facetPath[0]);
+// if(facetPath.size() > 1)
+// {
+// throw MarshalException(__FILE__, __LINE__);
+// }
+// facet.swap(facetPath[0]);
// }
// _current.facet.swap(facet);
Int sz;
_is.readSize(sz);
if(sz > 0)
{
- if(sz > 1)
- {
- throw MarshalException(__FILE__, __LINE__);
- }
- _is.read(_current.facet);
+ if(sz > 1)
+ {
+ throw MarshalException(__FILE__, __LINE__);
+ }
+ _is.read(_current.facet);
}
else
{
- _current.facet.clear();
+ _current.facet.clear();
}
_is.read(_current.operation, false);
@@ -116,19 +116,19 @@ IceInternal::Incoming::invoke(bool response, Int requestId)
_is.readSize(sz);
while(sz--)
{
- pair<const string, string> pr;
- _is.read(const_cast<string&>(pr.first));
- _is.read(pr.second);
- _current.ctx.insert(_current.ctx.end(), pr);
+ pair<const string, string> pr;
+ _is.read(const_cast<string&>(pr.first));
+ _is.read(pr.second);
+ _current.ctx.insert(_current.ctx.end(), pr);
}
_is.startReadEncaps();
if(response)
{
- assert(_os.b.size() == headerSize + 4); // Reply status position.
- _os.write(replyOK);
- _os.startWriteEncaps();
+ assert(_os.b.size() == headerSize + 4); // Reply status position.
+ _os.write(replyOK);
+ _os.startWriteEncaps();
}
@@ -143,294 +143,294 @@ IceInternal::Incoming::invoke(bool response, Int requestId)
try
{
- Ice::ObjectPtr servant;
- if(_servantManager)
- {
- servant = _servantManager->findServant(_current.id, _current.facet);
- }
-
- if(!servant)
- {
- if(_servantManager && _servantManager->hasServant(_current.id))
- {
- replyStatus = replyFacetNotExist;
- }
- else
- {
- replyStatus = replyObjectNotExist;
- }
- }
- else
- {
- dispatchStatus = servant->__dispatch(*this, _current);
+ Ice::ObjectPtr servant;
+ if(_servantManager)
+ {
+ servant = _servantManager->findServant(_current.id, _current.facet);
+ }
+
+ if(!servant)
+ {
+ if(_servantManager && _servantManager->hasServant(_current.id))
+ {
+ replyStatus = replyFacetNotExist;
+ }
+ else
+ {
+ replyStatus = replyObjectNotExist;
+ }
+ }
+ else
+ {
+ dispatchStatus = servant->__dispatch(*this, _current);
if(dispatchStatus == DispatchUserException)
{
replyStatus = replyUserException;
}
- }
+ }
}
catch(RequestFailedException& ex)
{
- _is.endReadEncaps();
-
- if(ex.id.name.empty())
- {
- ex.id = _current.id;
- }
-
- if(ex.facet.empty() && !_current.facet.empty())
- {
- ex.facet = _current.facet;
- }
-
- if(ex.operation.empty() && !_current.operation.empty())
- {
- ex.operation = _current.operation;
- }
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- if(dynamic_cast<ObjectNotExistException*>(&ex))
- {
- _os.write(replyObjectNotExist);
- }
- else if(dynamic_cast<FacetNotExistException*>(&ex))
- {
- _os.write(replyFacetNotExist);
- }
- else if(dynamic_cast<OperationNotExistException*>(&ex))
- {
- _os.write(replyOperationNotExist);
- }
- else
- {
- assert(false);
- }
-
- ex.id.__write(&_os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(ex.facet.empty())
- {
- _os.write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- _os.write(&ex.facet, &ex.facet + 1);
- }
-
- _os.write(ex.operation, false);
-
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(ex.id.name.empty())
+ {
+ ex.id = _current.id;
+ }
+
+ if(ex.facet.empty() && !_current.facet.empty())
+ {
+ ex.facet = _current.facet;
+ }
+
+ if(ex.operation.empty() && !_current.operation.empty())
+ {
+ ex.operation = _current.operation;
+ }
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ if(dynamic_cast<ObjectNotExistException*>(&ex))
+ {
+ _os.write(replyObjectNotExist);
+ }
+ else if(dynamic_cast<FacetNotExistException*>(&ex))
+ {
+ _os.write(replyFacetNotExist);
+ }
+ else if(dynamic_cast<OperationNotExistException*>(&ex))
+ {
+ _os.write(replyOperationNotExist);
+ }
+ else
+ {
+ assert(false);
+ }
+
+ ex.id.__write(&_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(ex.facet.empty())
+ {
+ _os.write(static_cast<string*>(0), static_cast<string*>(0));
+ }
+ else
+ {
+ _os.write(&ex.facet, &ex.facet + 1);
+ }
+
+ _os.write(ex.operation, false);
+
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const UnknownLocalException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownLocalException);
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownLocalException);
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const UnknownUserException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownUserException);
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownUserException);
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const UnknownException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownException);
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownException);
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const LocalException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownLocalException);
- _os.write(ex.toString(), false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownLocalException);
+ _os.write(ex.toString(), false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const UserException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownUserException);
- _os.write(ex.toString(), false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownUserException);
+ _os.write(ex.toString(), false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const Exception& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownException);
- _os.write(ex.toString(), false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownException);
+ _os.write(ex.toString(), false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const std::exception& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(string("std::exception: ") + ex.what());
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownException);
- string msg = string("std::exception: ") + ex.what();
- _os.write(msg, false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(string("std::exception: ") + ex.what());
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownException);
+ string msg = string("std::exception: ") + ex.what();
+ _os.write(msg, false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(...)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning("unknown c++ exception");
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownException);
- _os.write(string("unknown c++ exception"), false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning("unknown c++ exception");
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownException);
+ _os.write(string("unknown c++ exception"), false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
//
@@ -443,42 +443,42 @@ IceInternal::Incoming::invoke(bool response, Int requestId)
if(response)
{
- _os.endWriteEncaps();
-
- if(replyStatus != replyOK && replyStatus != replyUserException)
- {
- assert(replyStatus == replyObjectNotExist ||
- replyStatus == replyFacetNotExist);
-
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyStatus);
-
- _current.id.__write(&_os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(_current.facet.empty())
- {
- _os.write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- _os.write(&_current.facet, &_current.facet + 1);
- }
-
- _os.write(_current.operation, false);
- }
- else
- {
- *(_os.b.begin() + headerSize + 4) = replyStatus; // Reply status position.
- }
-
- _connection->sendResponse(&_os);
+ _os.endWriteEncaps();
+
+ if(replyStatus != replyOK && replyStatus != replyUserException)
+ {
+ assert(replyStatus == replyObjectNotExist ||
+ replyStatus == replyFacetNotExist);
+
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyStatus);
+
+ _current.id.__write(&_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(_current.facet.empty())
+ {
+ _os.write(static_cast<string*>(0), static_cast<string*>(0));
+ }
+ else
+ {
+ _os.write(&_current.facet, &_current.facet + 1);
+ }
+
+ _os.write(_current.operation, false);
+ }
+ else
+ {
+ *(_os.b.begin() + headerSize + 4) = replyStatus; // Reply status position.
+ }
+
+ _connection->sendResponse(&_os);
}
else
{
- _connection->sendNoResponse();
+ _connection->sendNoResponse();
}
}
diff --git a/cppe/src/IceE/IncomingConnectionFactory.cpp b/cppe/src/IceE/IncomingConnectionFactory.cpp
index 8d124ad232c..d3c9cee90e3 100644
--- a/cppe/src/IceE/IncomingConnectionFactory.cpp
+++ b/cppe/src/IceE/IncomingConnectionFactory.cpp
@@ -53,22 +53,22 @@ IceInternal::IncomingConnectionFactory::waitUntilHolding() const
list<ConnectionPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the connection factory itself is in holding
- // state.
- //
- while(_state < StateHolding)
- {
- wait();
- }
-
- //
- // We want to wait until all connections are in holding state
- // outside the thread synchronization.
- //
- connections = _connections;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the connection factory itself is in holding
+ // state.
+ //
+ while(_state < StateHolding)
+ {
+ wait();
+ }
+
+ //
+ // We want to wait until all connections are in holding state
+ // outside the thread synchronization.
+ //
+ connections = _connections;
}
//
@@ -84,30 +84,30 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
list<ConnectionPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the factory is destroyed. If we are using
- // an acceptor, we also wait for it to be closed.
- //
- while(_state != StateClosed || _acceptor)
- {
- wait();
- }
-
- threadPerIncomingConnectionFactory = _threadPerIncomingConnectionFactory;
- _threadPerIncomingConnectionFactory = 0;
-
- //
- // We want to wait until all connections are finished outside the
- // thread synchronization.
- //
- connections.swap(_connections);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the factory is destroyed. If we are using
+ // an acceptor, we also wait for it to be closed.
+ //
+ while(_state != StateClosed || _acceptor)
+ {
+ wait();
+ }
+
+ threadPerIncomingConnectionFactory = _threadPerIncomingConnectionFactory;
+ _threadPerIncomingConnectionFactory = 0;
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ connections.swap(_connections);
}
if(threadPerIncomingConnectionFactory)
{
- threadPerIncomingConnectionFactory->getThreadControl().join();
+ threadPerIncomingConnectionFactory->getThreadControl().join();
}
for_each(connections.begin(), connections.end(), Ice::voidMemFun(&Connection::waitUntilFinished));
@@ -131,7 +131,7 @@ IceInternal::IncomingConnectionFactory::connections() const
// Only copy connections which have not been destroyed.
//
remove_copy_if(_connections.begin(), _connections.end(), back_inserter(result),
- Ice::constMemFun(&Connection::isDestroyed));
+ Ice::constMemFun(&Connection::isDestroyed));
return result;
}
@@ -143,14 +143,14 @@ IceInternal::IncomingConnectionFactory::flushBatchRequests()
for(list<ConnectionPtr>::const_iterator p = c.begin(); p != c.end(); ++p)
{
- try
- {
- (*p)->flushBatchRequests();
- }
- catch(const LocalException&)
- {
- // Ignore.
- }
+ try
+ {
+ (*p)->flushBatchRequests();
+ }
+ catch(const LocalException&)
+ {
+ // Ignore.
+ }
}
}
@@ -161,7 +161,7 @@ IceInternal::IncomingConnectionFactory::toString() const
if(_transceiver)
{
- return _transceiver->toString();
+ return _transceiver->toString();
}
assert(_acceptor);
@@ -169,8 +169,8 @@ IceInternal::IncomingConnectionFactory::toString() const
}
IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const InstancePtr& instance,
- const EndpointPtr& endpoint,
- const ObjectAdapterPtr& adapter) :
+ const EndpointPtr& endpoint,
+ const ObjectAdapterPtr& adapter) :
_instance(instance),
_endpoint(endpoint),
_adapter(adapter),
@@ -179,8 +179,8 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
{
if(_instance->defaultsAndOverrides()->overrideTimeout)
{
- const_cast<EndpointPtr&>(_endpoint) =
- _endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ const_cast<EndpointPtr&>(_endpoint) =
+ _endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
}
_acceptor = _endpoint->acceptor(const_cast<EndpointPtr&>(_endpoint));
@@ -190,36 +190,36 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
__setNoDelete(true);
try
{
- //
- // If we are in thread per connection mode, we also use one
- // thread per incoming connection factory, that accepts new
- // connections on this endpoint.
- //
- _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this);
- _threadPerIncomingConnectionFactory->start(_instance->threadPerConnectionStackSize());
+ //
+ // If we are in thread per connection mode, we also use one
+ // thread per incoming connection factory, that accepts new
+ // connections on this endpoint.
+ //
+ _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this);
+ _threadPerIncomingConnectionFactory->start(_instance->threadPerConnectionStackSize());
}
catch(const Ice::Exception& ex)
{
- {
- Error out(_instance->initializationData().logger);
- out << "cannot create thread for incoming connection factory:\n" << ex.toString();
- }
-
- try
- {
- _acceptor->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
-
- _state = StateClosed;
- _acceptor = 0;
- _threadPerIncomingConnectionFactory = 0;
-
- __setNoDelete(false);
- ex.ice_throw();
+ {
+ Error out(_instance->initializationData().logger);
+ out << "cannot create thread for incoming connection factory:\n" << ex.toString();
+ }
+
+ try
+ {
+ _acceptor->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ _state = StateClosed;
+ _acceptor = 0;
+ _threadPerIncomingConnectionFactory = 0;
+
+ __setNoDelete(false);
+ ex.ice_throw();
}
__setNoDelete(false);
}
@@ -239,52 +239,52 @@ IceInternal::IncomingConnectionFactory::setState(State state)
{
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
switch(state)
{
- case StateActive:
- {
- if(_state != StateHolding) // Can only switch from holding to active.
- {
- return;
- }
- for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::activate));
- break;
- }
-
- case StateHolding:
- {
- if(_state != StateActive) // Can only switch from active to holding.
- {
- return;
- }
- for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::hold));
- break;
- }
-
- case StateClosed:
- {
- if(_acceptor)
- {
- //
- // Connect to our own acceptor, which unblocks our
- // thread per incoming connection factory stuck in accept().
- //
- _acceptor->connectToSelf();
- }
+ case StateActive:
+ {
+ if(_state != StateHolding) // Can only switch from holding to active.
+ {
+ return;
+ }
+ for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::activate));
+ break;
+ }
+
+ case StateHolding:
+ {
+ if(_state != StateActive) // Can only switch from active to holding.
+ {
+ return;
+ }
+ for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::hold));
+ break;
+ }
+
+ case StateClosed:
+ {
+ if(_acceptor)
+ {
+ //
+ // Connect to our own acceptor, which unblocks our
+ // thread per incoming connection factory stuck in accept().
+ //
+ _acceptor->connectToSelf();
+ }
#ifdef _STLP_BEGIN_NAMESPACE
- // voidbind2nd is an STLport extension for broken compilers in IceE/Functional.h
- for_each(_connections.begin(), _connections.end(),
- voidbind2nd(Ice::voidMemFun1(&Connection::destroy), Connection::ObjectAdapterDeactivated));
+ // voidbind2nd is an STLport extension for broken compilers in IceE/Functional.h
+ for_each(_connections.begin(), _connections.end(),
+ voidbind2nd(Ice::voidMemFun1(&Connection::destroy), Connection::ObjectAdapterDeactivated));
#else
- for_each(_connections.begin(), _connections.end(),
- bind2nd(Ice::voidMemFun1(&Connection::destroy), Connection::ObjectAdapterDeactivated));
+ for_each(_connections.begin(), _connections.end(),
+ bind2nd(Ice::voidMemFun1(&Connection::destroy), Connection::ObjectAdapterDeactivated));
#endif
- break;
- }
+ break;
+ }
}
_state = state;
@@ -298,109 +298,109 @@ IceInternal::IncomingConnectionFactory::run()
while(true)
{
- //
- // We must accept new connections outside the thread
- // synchronization, because we use blocking accept.
- //
- TransceiverPtr transceiver;
- try
- {
- transceiver = _acceptor->accept();
- }
- catch(const SocketException&)
- {
- // Ignore socket exceptions.
- }
- catch(const TimeoutException&)
- {
- // Ignore timeouts.
- }
- catch(const LocalException& ex)
- {
- // Warn about other Ice local exceptions.
- if(_warn)
- {
- Warning out(_instance->initializationData().logger);
- out << "connection exception:\n" << ex.toString() << "\n" << _acceptor->toString();
- }
- }
-
- ConnectionPtr connection;
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- while(_state == StateHolding)
- {
- wait();
- }
-
- if(_state == StateClosed)
- {
- if(transceiver)
- {
- try
- {
- transceiver->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
- }
-
- try
- {
- _acceptor->close();
- }
- catch(const LocalException& ex)
- {
- _acceptor = 0;
- notifyAll();
- ex.ice_throw();
- }
-
- _acceptor = 0;
- notifyAll();
- return;
- }
-
- assert(_state == StateActive);
-
- //
- // Reap connections for which destruction has completed.
- //
- _connections.erase(remove_if(_connections.begin(), _connections.end(),
- Ice::constMemFun(&Connection::isFinished)),
- _connections.end());
-
- //
- // Create a connection object for the connection.
- //
- if(transceiver)
- {
- try
- {
- connection = new Connection(_instance, transceiver, _endpoint, _adapter);
- }
- catch(const LocalException&)
- {
- return;
- }
-
- _connections.push_back(connection);
- }
- }
-
- //
- // In thread per connection mode, the connection's thread will
- // take care of connection validation and activation. We don't
- // want to block this thread waiting until validation is
- // complete because it is the only thread that can accept
- // connections with this factory's acceptor. Therefore we
- // don't call validate() and activate() from the connection
- // factory in thread per connection mode.
- //
+ //
+ // We must accept new connections outside the thread
+ // synchronization, because we use blocking accept.
+ //
+ TransceiverPtr transceiver;
+ try
+ {
+ transceiver = _acceptor->accept();
+ }
+ catch(const SocketException&)
+ {
+ // Ignore socket exceptions.
+ }
+ catch(const TimeoutException&)
+ {
+ // Ignore timeouts.
+ }
+ catch(const LocalException& ex)
+ {
+ // Warn about other Ice local exceptions.
+ if(_warn)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "connection exception:\n" << ex.toString() << "\n" << _acceptor->toString();
+ }
+ }
+
+ ConnectionPtr connection;
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ while(_state == StateHolding)
+ {
+ wait();
+ }
+
+ if(_state == StateClosed)
+ {
+ if(transceiver)
+ {
+ try
+ {
+ transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+ }
+
+ try
+ {
+ _acceptor->close();
+ }
+ catch(const LocalException& ex)
+ {
+ _acceptor = 0;
+ notifyAll();
+ ex.ice_throw();
+ }
+
+ _acceptor = 0;
+ notifyAll();
+ return;
+ }
+
+ assert(_state == StateActive);
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ _connections.erase(remove_if(_connections.begin(), _connections.end(),
+ Ice::constMemFun(&Connection::isFinished)),
+ _connections.end());
+
+ //
+ // Create a connection object for the connection.
+ //
+ if(transceiver)
+ {
+ try
+ {
+ connection = new Connection(_instance, transceiver, _endpoint, _adapter);
+ }
+ catch(const LocalException&)
+ {
+ return;
+ }
+
+ _connections.push_back(connection);
+ }
+ }
+
+ //
+ // In thread per connection mode, the connection's thread will
+ // take care of connection validation and activation. We don't
+ // want to block this thread waiting until validation is
+ // complete because it is the only thread that can accept
+ // connections with this factory's acceptor. Therefore we
+ // don't call validate() and activate() from the connection
+ // factory in thread per connection mode.
+ //
}
}
@@ -415,22 +415,22 @@ IceInternal::IncomingConnectionFactory::ThreadPerIncomingConnectionFactory::run(
{
try
{
- _factory->run();
+ _factory->run();
}
catch(const Exception& ex)
- {
- Error out(_factory->_instance->initializationData().logger);
- out << "exception in thread per incoming connection factory:\n" << _factory->toString() << ex.toString();
+ {
+ Error out(_factory->_instance->initializationData().logger);
+ out << "exception in thread per incoming connection factory:\n" << _factory->toString() << ex.toString();
}
catch(const std::exception& ex)
{
- Error out(_factory->_instance->initializationData().logger);
- out << "std::exception in thread per incoming connection factory:\n" << _factory->toString() << ex.what();
+ Error out(_factory->_instance->initializationData().logger);
+ out << "std::exception in thread per incoming connection factory:\n" << _factory->toString() << ex.what();
}
catch(...)
{
- Error out(_factory->_instance->initializationData().logger);
- out << "unknown exception in thread per incoming connection factory:\n" << _factory->toString();
+ Error out(_factory->_instance->initializationData().logger);
+ out << "unknown exception in thread per incoming connection factory:\n" << _factory->toString();
}
_factory = 0; // Resolve cyclic dependency.
diff --git a/cppe/src/IceE/IncomingConnectionFactory.h b/cppe/src/IceE/IncomingConnectionFactory.h
index 766816054fa..0150c81b017 100644
--- a/cppe/src/IceE/IncomingConnectionFactory.h
+++ b/cppe/src/IceE/IncomingConnectionFactory.h
@@ -55,9 +55,9 @@ private:
enum State
{
- StateActive,
- StateHolding,
- StateClosed
+ StateActive,
+ StateHolding,
+ StateClosed
};
void setState(State);
@@ -67,13 +67,13 @@ private:
class ThreadPerIncomingConnectionFactory : public IceUtil::Thread
{
public:
-
- ThreadPerIncomingConnectionFactory(const IncomingConnectionFactoryPtr&);
- virtual void run();
+
+ ThreadPerIncomingConnectionFactory(const IncomingConnectionFactoryPtr&);
+ virtual void run();
private:
-
- IncomingConnectionFactoryPtr _factory;
+
+ IncomingConnectionFactoryPtr _factory;
};
friend class ThreadPerIncomingConnectionFactory;
IceUtil::ThreadPtr _threadPerIncomingConnectionFactory;
diff --git a/cppe/src/IceE/Initialize.cpp b/cppe/src/IceE/Initialize.cpp
index 9c10c2e0605..13d09f0e2a8 100644
--- a/cppe/src/IceE/Initialize.cpp
+++ b/cppe/src/IceE/Initialize.cpp
@@ -56,7 +56,7 @@ Ice::stringSeqToArgs(const StringSeq& args, int& argc, char* argv[])
//
if(argv)
{
- argv[argc] = 0;
+ argv[argc] = 0;
}
}
@@ -113,7 +113,7 @@ inline void checkIceVersion(Int version)
//
if(ICEE_INT_VERSION / 100 != version / 100)
{
- throw VersionMismatchException(__FILE__, __LINE__);
+ throw VersionMismatchException(__FILE__, __LINE__);
}
//
// The caller's patch level cannot be greater than library's patch level. (Patch level changes are
@@ -121,7 +121,7 @@ inline void checkIceVersion(Int version)
//
if(version % 100 > ICEE_INT_VERSION % 100)
{
- throw VersionMismatchException(__FILE__, __LINE__);
+ throw VersionMismatchException(__FILE__, __LINE__);
}
#endif
}
@@ -149,42 +149,42 @@ Ice::initialize(StringSeq& args, const InitializationData& initializationData, I
CommunicatorPtr communicator;
try
{
- //
- // Make a dummy argc/argv.
- // (We can't use argsToStringSeq() because that requires an already initialized argv.)
- //
- int argc = args.size();
- origArgc = argc;
- argv = new char*[args.size() + 1];
- int i;
- for(i = 0; i != argc; ++i)
- {
- argv[i] = new char[args[i].size() + 1];
+ //
+ // Make a dummy argc/argv.
+ // (We can't use argsToStringSeq() because that requires an already initialized argv.)
+ //
+ int argc = args.size();
+ origArgc = argc;
+ argv = new char*[args.size() + 1];
+ int i;
+ for(i = 0; i != argc; ++i)
+ {
+ argv[i] = new char[args[i].size() + 1];
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
- strcpy_s(argv[i], args[i].size() + 1, args[i].c_str());
+ strcpy_s(argv[i], args[i].size() + 1, args[i].c_str());
#else
- strcpy(argv[i], args[i].c_str());
+ strcpy(argv[i], args[i].c_str());
#endif
- }
- argv[argc] = 0;
-
- communicator = initialize(argc, argv, initializationData, version);
-
- args = argsToStringSeq(argc, argv);
-
- for(i = 0; i < origArgc; ++i)
- {
- delete[] argv[i];
- }
- delete[] argv;
+ }
+ argv[argc] = 0;
+
+ communicator = initialize(argc, argv, initializationData, version);
+
+ args = argsToStringSeq(argc, argv);
+
+ for(i = 0; i < origArgc; ++i)
+ {
+ delete[] argv[i];
+ }
+ delete[] argv;
}
catch(...)
{
- for(int i = 0; i < origArgc; ++i)
- {
- delete[] argv[i];
- }
- delete[] argv;
+ for(int i = 0; i < origArgc; ++i)
+ {
+ delete[] argv[i];
+ }
+ delete[] argv;
throw;
}
return communicator;
diff --git a/cppe/src/IceE/Instance.cpp b/cppe/src/IceE/Instance.cpp
index 27cc1453802..81221c987bd 100644
--- a/cppe/src/IceE/Instance.cpp
+++ b/cppe/src/IceE/Instance.cpp
@@ -88,7 +88,7 @@ IceInternal::Instance::routerManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _routerManager;
@@ -105,7 +105,7 @@ IceInternal::Instance::locatorManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _locatorManager;
@@ -120,7 +120,7 @@ IceInternal::Instance::referenceFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _referenceFactory;
@@ -133,7 +133,7 @@ IceInternal::Instance::proxyFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _proxyFactory;
@@ -146,7 +146,7 @@ IceInternal::Instance::outgoingConnectionFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _outgoingConnectionFactory;
@@ -160,7 +160,7 @@ IceInternal::Instance::objectAdapterFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _objectAdapterFactory;
@@ -183,7 +183,7 @@ IceInternal::Instance::endpointFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _endpointFactory;
@@ -200,16 +200,16 @@ IceInternal::Instance::flushBatchRequests()
#endif
{
- IceUtil::RecMutex::Lock sync(*this);
+ IceUtil::RecMutex::Lock sync(*this);
- if(_state == StateDestroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
+ if(_state == StateDestroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
- connectionFactory = _outgoingConnectionFactory;
+ connectionFactory = _outgoingConnectionFactory;
#ifndef ICEE_PURE_CLIENT
- adapterFactory = _objectAdapterFactory;
+ adapterFactory = _objectAdapterFactory;
#endif
}
@@ -337,181 +337,181 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
{
try
{
- __setNoDelete(true);
-
- IceUtil::StaticMutex::Lock sync(staticMutex);
- instanceCount++;
-
- if(!oneOffDone)
- {
- //
- // StdOut and StdErr redirection
- //
-
- string stdOutFilename = _initData.properties->getProperty("Ice.StdOut");
- string stdErrFilename = _initData.properties->getProperty("Ice.StdErr");
-
- if(stdOutFilename != "")
- {
- FILE * file;
+ __setNoDelete(true);
+
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ instanceCount++;
+
+ if(!oneOffDone)
+ {
+ //
+ // StdOut and StdErr redirection
+ //
+
+ string stdOutFilename = _initData.properties->getProperty("Ice.StdOut");
+ string stdErrFilename = _initData.properties->getProperty("Ice.StdErr");
+
+ if(stdOutFilename != "")
+ {
+ FILE * file;
#ifdef _WIN32_WCE
- wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdOutFilename.length()];
- mbstowcs(wtext, stdOutFilename.c_str(), stdOutFilename.length());
- file = _wfreopen(wtext, L"a", stdout);
- delete wtext;
+ wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdOutFilename.length()];
+ mbstowcs(wtext, stdOutFilename.c_str(), stdOutFilename.length());
+ file = _wfreopen(wtext, L"a", stdout);
+ delete wtext;
#else
- file = freopen(stdOutFilename.c_str(), "a", stdout);
-#endif
- if(file == 0)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- }
-
- if(stdErrFilename != "")
- {
- FILE* file;
+ file = freopen(stdOutFilename.c_str(), "a", stdout);
+#endif
+ if(file == 0)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
+
+ if(stdErrFilename != "")
+ {
+ FILE* file;
#ifdef _WIN32_WCE
- wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdErrFilename.length()];
- mbstowcs(wtext, stdErrFilename.c_str(), stdErrFilename.length());
- file = _wfreopen(wtext, L"a", stderr);
- delete wtext;
+ wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdErrFilename.length()];
+ mbstowcs(wtext, stdErrFilename.c_str(), stdErrFilename.length());
+ file = _wfreopen(wtext, L"a", stderr);
+ delete wtext;
#else
- file = freopen(stdErrFilename.c_str(), "a", stderr);
-#endif
- if(file == 0)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- }
-
- unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
- srand(seed);
+ file = freopen(stdErrFilename.c_str(), "a", stderr);
+#endif
+ if(file == 0)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
+
+ unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
+ srand(seed);
#ifndef _WIN32
- srand48(seed);
-#endif
-
- if(_initData.properties->getPropertyAsInt("Ice.NullHandleAbort") > 0)
- {
- IceUtil::nullHandleAbort = true;
- }
-
+ srand48(seed);
+#endif
+
+ if(_initData.properties->getPropertyAsInt("Ice.NullHandleAbort") > 0)
+ {
+ IceUtil::nullHandleAbort = true;
+ }
+
#ifndef _WIN32
- string newUser = _initData.properties->getProperty("Ice.ChangeUser");
- if(!newUser.empty())
- {
- struct passwd* pw = getpwnam(newUser.c_str());
- if(!pw)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
- if(setgid(pw->pw_gid) == -1)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
- if(setuid(pw->pw_uid) == -1)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- }
-#endif
- oneOffDone = true;
- }
-
- if(instanceCount == 1)
- {
-
+ string newUser = _initData.properties->getProperty("Ice.ChangeUser");
+ if(!newUser.empty())
+ {
+ struct passwd* pw = getpwnam(newUser.c_str());
+ if(!pw)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+
+ if(setgid(pw->pw_gid) == -1)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+
+ if(setuid(pw->pw_uid) == -1)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
+#endif
+ oneOffDone = true;
+ }
+
+ if(instanceCount == 1)
+ {
+
#ifdef _WIN32
- WORD version = MAKEWORD(1, 1);
- WSADATA data;
- if(WSAStartup(version, &data) != 0)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
- }
-#endif
-
+ WORD version = MAKEWORD(1, 1);
+ WSADATA data;
+ if(WSAStartup(version, &data) != 0)
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
+ }
+#endif
+
#ifndef _WIN32
- struct sigaction action;
- action.sa_handler = SIG_IGN;
- sigemptyset(&action.sa_mask);
- action.sa_flags = 0;
- sigaction(SIGPIPE, &action, 0);
-#endif
- }
-
- sync.release();
-
-
- if(!_initData.logger)
- {
- _initData.logger = new LoggerI(_initData.properties->getProperty("Ice.ProgramName"));
- }
-
- const_cast<TraceLevelsPtr&>(_traceLevels) = new TraceLevels(_initData.properties);
-
- const_cast<DefaultsAndOverridesPtr&>(_defaultsAndOverrides) = new DefaultsAndOverrides(_initData.properties);
-
- {
- static const int defaultMessageSizeMax = 1024;
- Int num = _initData.properties->getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
- if(num < 1)
- {
- const_cast<size_t&>(_messageSizeMax) = defaultMessageSizeMax * 1024; // Ignore non-sensical values.
- }
- else if(static_cast<size_t>(num) > (size_t)(0x7fffffff / 1024))
- {
- const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(0x7fffffff);
- }
- else
- {
- // Property is in kilobytes, _messageSizeMax in bytes.
- const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(num) * 1024;
- }
- }
+ struct sigaction action;
+ action.sa_handler = SIG_IGN;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction(SIGPIPE, &action, 0);
+#endif
+ }
+
+ sync.release();
+
+
+ if(!_initData.logger)
+ {
+ _initData.logger = new LoggerI(_initData.properties->getProperty("Ice.ProgramName"));
+ }
+
+ const_cast<TraceLevelsPtr&>(_traceLevels) = new TraceLevels(_initData.properties);
+
+ const_cast<DefaultsAndOverridesPtr&>(_defaultsAndOverrides) = new DefaultsAndOverrides(_initData.properties);
+
+ {
+ static const int defaultMessageSizeMax = 1024;
+ Int num = _initData.properties->getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
+ if(num < 1)
+ {
+ const_cast<size_t&>(_messageSizeMax) = defaultMessageSizeMax * 1024; // Ignore non-sensical values.
+ }
+ else if(static_cast<size_t>(num) > (size_t)(0x7fffffff / 1024))
+ {
+ const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(0x7fffffff);
+ }
+ else
+ {
+ // Property is in kilobytes, _messageSizeMax in bytes.
+ const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(num) * 1024;
+ }
+ }
#ifndef ICEE_PURE_BLOCKING_CLIENT
- {
- Int stackSize = _initData.properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
- if(stackSize < 0)
- {
- stackSize = 0;
- }
- const_cast<size_t&>(_threadPerConnectionStackSize) = static_cast<size_t>(stackSize);
- }
+ {
+ Int stackSize = _initData.properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
+ if(stackSize < 0)
+ {
+ stackSize = 0;
+ }
+ const_cast<size_t&>(_threadPerConnectionStackSize) = static_cast<size_t>(stackSize);
+ }
#endif
#ifdef ICEE_HAS_ROUTER
- _routerManager = new RouterManager;
+ _routerManager = new RouterManager;
#endif
#ifdef ICEE_HAS_LOCATOR
- _locatorManager = new LocatorManager;
+ _locatorManager = new LocatorManager;
#endif
- _referenceFactory = new ReferenceFactory(this, communicator);
+ _referenceFactory = new ReferenceFactory(this, communicator);
- _proxyFactory = new ProxyFactory(this);
+ _proxyFactory = new ProxyFactory(this);
_endpointFactory = new EndpointFactory(this);
- _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
+ _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
#ifndef ICEE_PURE_CLIENT
- _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
+ _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
#endif
#ifdef ICEE_HAS_WSTRING
@@ -521,17 +521,17 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
}
#endif
- __setNoDelete(false);
+ __setNoDelete(false);
}
catch(...)
{
- {
- IceUtil::StaticMutex::Lock sync(staticMutex);
- --instanceCount;
- }
- destroy();
- __setNoDelete(false);
- throw;
+ {
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ --instanceCount;
+ }
+ destroy();
+ __setNoDelete(false);
+ throw;
}
}
@@ -556,15 +556,15 @@ IceInternal::Instance::~Instance()
if(--instanceCount == 0)
{
#ifdef _WIN32
- WSACleanup();
+ WSACleanup();
#endif
-
+
#ifndef _WIN32
- struct sigaction action;
- action.sa_handler = SIG_DFL;
- sigemptyset(&action.sa_mask);
- action.sa_flags = 0;
- sigaction(SIGPIPE, &action, 0);
+ struct sigaction action;
+ action.sa_handler = SIG_DFL;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction(SIGPIPE, &action, 0);
#endif
}
}
@@ -580,16 +580,16 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
#ifdef ICEE_HAS_ROUTER
if(!_defaultsAndOverrides->defaultRouter.empty())
{
- _referenceFactory->setDefaultRouter(
- RouterPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultRouter)));
+ _referenceFactory->setDefaultRouter(
+ RouterPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultRouter)));
}
#endif
#ifdef ICEE_HAS_LOCATOR
if(!_defaultsAndOverrides->defaultLocator.empty())
{
- _referenceFactory->setDefaultLocator(
- LocatorPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultLocator)));
+ _referenceFactory->setDefaultLocator(
+ LocatorPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultLocator)));
}
#endif
@@ -600,26 +600,26 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
bool printProcessId = false;
if(!printProcessIdDone && _initData.properties->getPropertyAsInt("Ice.PrintProcessId") > 0)
{
- //
- // Safe double-check locking (no dependent variable!)
- //
- IceUtil::StaticMutex::Lock sync(staticMutex);
- printProcessId = !printProcessIdDone;
-
- //
- // We anticipate: we want to print it once, and we don't care when.
- //
- printProcessIdDone = true;
+ //
+ // Safe double-check locking (no dependent variable!)
+ //
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ printProcessId = !printProcessIdDone;
+
+ //
+ // We anticipate: we want to print it once, and we don't care when.
+ //
+ printProcessIdDone = true;
}
if(printProcessId)
{
#ifdef _WIN32
- printf("%d\n", _getpid());
+ printf("%d\n", _getpid());
#else
- printf("%d\n", getpid());
+ printf("%d\n", getpid());
#endif
- fflush(stdout);
+ fflush(stdout);
}
#endif
}
@@ -628,30 +628,30 @@ void
IceInternal::Instance::destroy()
{
{
- IceUtil::RecMutex::Lock sync(*this);
-
- //
- // If the _state is not StateActive then the instance is
- // either being destroyed, or has already been destroyed.
- //
- if(_state != StateActive)
- {
- return;
- }
-
- //
- // We cannot set state to StateDestroyed otherwise instance
- // methods called during the destroy process (such as
- // outgoingConnectionFactory() from
- // ObjectAdapterI::deactivate() will cause an exception.
- //
- _state = StateDestroyInProgress;
+ IceUtil::RecMutex::Lock sync(*this);
+
+ //
+ // If the _state is not StateActive then the instance is
+ // either being destroyed, or has already been destroyed.
+ //
+ if(_state != StateActive)
+ {
+ return;
+ }
+
+ //
+ // We cannot set state to StateDestroyed otherwise instance
+ // methods called during the destroy process (such as
+ // outgoingConnectionFactory() from
+ // ObjectAdapterI::deactivate() will cause an exception.
+ //
+ _state = StateDestroyInProgress;
}
#ifndef ICEE_PURE_CLIENT
if(_objectAdapterFactory)
{
- _objectAdapterFactory->shutdown();
+ _objectAdapterFactory->shutdown();
}
if(_outgoingConnectionFactory)
@@ -677,46 +677,46 @@ IceInternal::Instance::destroy()
#endif
{
- IceUtil::RecMutex::Lock sync(*this);
+ IceUtil::RecMutex::Lock sync(*this);
#ifndef ICEE_PURE_CLIENT
- _objectAdapterFactory = 0;
-#endif
- _outgoingConnectionFactory = 0;
-
- if(_referenceFactory)
- {
- _referenceFactory->destroy();
- _referenceFactory = 0;
- }
-
- // No destroy function defined.
- // _proxyFactory->destroy();
- _proxyFactory = 0;
-
+ _objectAdapterFactory = 0;
+#endif
+ _outgoingConnectionFactory = 0;
+
+ if(_referenceFactory)
+ {
+ _referenceFactory->destroy();
+ _referenceFactory = 0;
+ }
+
+ // No destroy function defined.
+ // _proxyFactory->destroy();
+ _proxyFactory = 0;
+
#ifdef ICEE_HAS_ROUTER
- if(_routerManager)
- {
- _routerManager->destroy();
- _routerManager = 0;
- }
+ if(_routerManager)
+ {
+ _routerManager->destroy();
+ _routerManager = 0;
+ }
#endif
#ifdef ICEE_HAS_LOCATOR
- if(_locatorManager)
- {
- _locatorManager->destroy();
- _locatorManager = 0;
- }
+ if(_locatorManager)
+ {
+ _locatorManager->destroy();
+ _locatorManager = 0;
+ }
#endif
- if(_endpointFactory)
- {
- _endpointFactory->destroy();
- _endpointFactory = 0;
- }
+ if(_endpointFactory)
+ {
+ _endpointFactory->destroy();
+ _endpointFactory = 0;
+ }
- _state = StateDestroyed;
+ _state = StateDestroyed;
}
}
diff --git a/cppe/src/IceE/Instance.h b/cppe/src/IceE/Instance.h
index 7c6c58efd20..9d844e0266a 100644
--- a/cppe/src/IceE/Instance.h
+++ b/cppe/src/IceE/Instance.h
@@ -78,9 +78,9 @@ private:
enum State
{
- StateActive,
- StateDestroyInProgress,
- StateDestroyed
+ StateActive,
+ StateDestroyInProgress,
+ StateDestroyed
};
State _state;
Ice::InitializationData _initData; // Immutable, not reset by destroy().
diff --git a/cppe/src/IceE/LocalException.cpp b/cppe/src/IceE/LocalException.cpp
index c785547149c..d35cf32c2a8 100644
--- a/cppe/src/IceE/LocalException.cpp
+++ b/cppe/src/IceE/LocalException.cpp
@@ -1502,13 +1502,13 @@ Ice::MemoryLimitException::ice_throw() const
void
Ice::throwMemoryLimitException(const char* file, int line)
{
- throw MemoryLimitException(file, line);
+ throw MemoryLimitException(file, line);
}
void
Ice::throwUnmarshalOutOfBoundsException(const char* file, int line)
{
- throw MarshalException(file, line, "out of bounds during unmarshaling");
+ throw MarshalException(file, line, "out of bounds during unmarshaling");
}
void
@@ -1644,8 +1644,8 @@ Ice::UnknownException::toString() const
out += ":\nunknown exception";
if(!unknown.empty())
{
- out += ":\n";
- out += unknown;
+ out += ":\n";
+ out += unknown;
}
return out;
}
@@ -1657,8 +1657,8 @@ Ice::UnknownLocalException::toString() const
out += ":\nunknown local exception";
if(!unknown.empty())
{
- out += ":\n";
- out += unknown;
+ out += ":\n";
+ out += unknown;
}
return out;
}
@@ -1670,8 +1670,8 @@ Ice::UnknownUserException::toString() const
out += ":\nunknown user exception";
if(!unknown.empty())
{
- out += ":\n";
- out += unknown;
+ out += ":\n";
+ out += unknown;
}
return out;
}
@@ -1814,7 +1814,7 @@ Ice::SyscallException::toString() const
if(error != 0)
{
out += ":\nsyscall exception: ";
- out += errorToString(error);
+ out += errorToString(error);
}
return out;
}
@@ -1842,9 +1842,9 @@ Ice::FileException::toString() const
{
- out += "\npath: ";
+ out += "\npath: ";
- out += path;
+ out += path;
}
@@ -1877,11 +1877,11 @@ Ice::ConnectionLostException::toString() const
out += ":\nconnection lost: ";
if(error == 0)
{
- out += "recv() returned zero";
+ out += "recv() returned zero";
}
else
{
- out += errorToString(error);
+ out += errorToString(error);
}
return out;
}
@@ -1928,11 +1928,11 @@ Ice::ProtocolException::toString() const
out += ":\nprotocol error: ";
if(!reason.empty())
{
- out += reason;
+ out += reason;
}
else
{
- out += "unknown protocol exception";
+ out += "unknown protocol exception";
}
return out;
}
@@ -1973,8 +1973,8 @@ Ice::MarshalException::toString() const
out += ":\nprotocol error: error during marshaling or unmarshaling";
if(!reason.empty())
{
- out += ":\n";
- out += reason;
+ out += ":\n";
+ out += reason;
}
return out;
}
diff --git a/cppe/src/IceE/LocatorInfo.cpp b/cppe/src/IceE/LocatorInfo.cpp
index 7dc7f5aa836..5158cb5b510 100644
--- a/cppe/src/IceE/LocatorInfo.cpp
+++ b/cppe/src/IceE/LocatorInfo.cpp
@@ -53,7 +53,7 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc)
{
if(!loc)
{
- return 0;
+ return 0;
}
LocatorPrx locator = LocatorPrx::uncheckedCast(loc->ice_locator(0)); // The locator can't be located.
@@ -68,38 +68,38 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc)
if(_tableHint != _table.end())
{
- if(_tableHint->first == locator)
- {
- p = _tableHint;
- }
+ if(_tableHint->first == locator)
+ {
+ p = _tableHint;
+ }
}
if(p == _table.end())
{
- p = _table.find(locator);
+ p = _table.find(locator);
}
if(p == _table.end())
{
- //
- // Rely on locator identity for the adapter table. We want to
- // have only one table per locator (not one per locator
- // proxy).
- //
- map<Identity, LocatorTablePtr>::iterator t = _locatorTables.find(locator->ice_getIdentity());
- if(t == _locatorTables.end())
- {
- t = _locatorTables.insert(_locatorTables.begin(),
- pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(),
- new LocatorTable()));
- }
-
- _tableHint = _table.insert(_tableHint,
- pair<const LocatorPrx, LocatorInfoPtr>(locator, new LocatorInfo(locator, t->second)));
+ //
+ // Rely on locator identity for the adapter table. We want to
+ // have only one table per locator (not one per locator
+ // proxy).
+ //
+ map<Identity, LocatorTablePtr>::iterator t = _locatorTables.find(locator->ice_getIdentity());
+ if(t == _locatorTables.end())
+ {
+ t = _locatorTables.insert(_locatorTables.begin(),
+ pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(),
+ new LocatorTable()));
+ }
+
+ _tableHint = _table.insert(_tableHint,
+ pair<const LocatorPrx, LocatorInfoPtr>(locator, new LocatorInfo(locator, t->second)));
}
else
{
- _tableHint = p;
+ _tableHint = p;
}
return _tableHint->second;
@@ -112,10 +112,10 @@ IceInternal::LocatorTable::LocatorTable()
void
IceInternal::LocatorTable::clear()
{
- IceUtil::Mutex::Lock sync(*this);
+ IceUtil::Mutex::Lock sync(*this);
- _adapterEndpointsMap.clear();
- _objectMap.clear();
+ _adapterEndpointsMap.clear();
+ _objectMap.clear();
}
bool
@@ -127,12 +127,12 @@ IceInternal::LocatorTable::getAdapterEndpoints(const string& adapter, vector<End
if(p != _adapterEndpointsMap.end())
{
- endpoints = p->second;
- return true;
+ endpoints = p->second;
+ return true;
}
else
{
- return false;
+ return false;
}
}
@@ -152,7 +152,7 @@ IceInternal::LocatorTable::removeAdapterEndpoints(const string& adapter)
map<string, vector<EndpointPtr> >::iterator p = _adapterEndpointsMap.find(adapter);
if(p == _adapterEndpointsMap.end())
{
- return vector<EndpointPtr>();
+ return vector<EndpointPtr>();
}
vector<EndpointPtr> endpoints = p->second;
@@ -171,12 +171,12 @@ IceInternal::LocatorTable::getProxy(const Identity& id, ObjectPrx& proxy) const
if(p != _objectMap.end())
{
- proxy = p->second;
- return true;
+ proxy = p->second;
+ return true;
}
else
{
- return false;
+ return false;
}
}
@@ -195,7 +195,7 @@ IceInternal::LocatorTable::removeProxy(const Identity& id)
map<Identity, ObjectPrx>::iterator p = _objectMap.find(id);
if(p == _objectMap.end())
{
- return 0;
+ return 0;
}
ObjectPrx proxy = p->second;
@@ -254,12 +254,12 @@ IceInternal::LocatorInfo::getLocatorRegistry()
if(!_locatorRegistry) // Lazy initialization.
{
- _locatorRegistry = _locator->getRegistry();
+ _locatorRegistry = _locator->getRegistry();
- //
- // The locator registry can't be located.
- //
- _locatorRegistry = LocatorRegistryPrx::uncheckedCast(_locatorRegistry->ice_locator(0));
+ //
+ // The locator registry can't be located.
+ //
+ _locatorRegistry = LocatorRegistryPrx::uncheckedCast(_locatorRegistry->ice_locator(0));
}
return _locatorRegistry;
@@ -274,11 +274,11 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
try
{
- if(!ref->getAdapterId().empty())
- {
- if(!_table->getAdapterEndpoints(ref->getAdapterId(), endpoints))
- {
- cached = false;
+ if(!ref->getAdapterId().empty())
+ {
+ if(!_table->getAdapterEndpoints(ref->getAdapterId(), endpoints))
+ {
+ cached = false;
if(ref->getInstance()->traceLevels()->location >= 1)
{
@@ -287,20 +287,20 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
out << "searching for adapter by id" << "\n";
out << "adapter = " << ref->getAdapterId();
}
-
- object = _locator->findAdapterById(ref->getAdapterId());
- if(object)
- {
- endpoints = object->__reference()->getEndpoints();
- _table->addAdapterEndpoints(ref->getAdapterId(), endpoints);
- }
- }
- }
- else
- {
- bool objectCached = true;
- if(!_table->getProxy(ref->getIdentity(), object))
- {
+
+ object = _locator->findAdapterById(ref->getAdapterId());
+ if(object)
+ {
+ endpoints = object->__reference()->getEndpoints();
+ _table->addAdapterEndpoints(ref->getAdapterId(), endpoints);
+ }
+ }
+ }
+ else
+ {
+ bool objectCached = true;
+ if(!_table->getProxy(ref->getIdentity(), object))
+ {
if(ref->getInstance()->traceLevels()->location >= 1)
{
@@ -310,37 +310,37 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
}
- objectCached = false;
- object = _locator->findObjectById(ref->getIdentity());
- }
-
- bool endpointsCached = true;
- if(object)
- {
- DirectReferencePtr odr = DirectReferencePtr::dynamicCast(object->__reference());
- if(odr)
- {
- endpointsCached = false;
- endpoints = odr->getEndpoints();
- }
- else
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- assert(oir);
- if(!oir->getAdapterId().empty())
- {
- endpoints = getEndpoints(oir, endpointsCached);
- }
- }
- }
-
- if(!objectCached && !endpoints.empty())
- {
- _table->addProxy(ref->getIdentity(), object);
- }
-
- cached = objectCached || endpointsCached;
- }
+ objectCached = false;
+ object = _locator->findObjectById(ref->getIdentity());
+ }
+
+ bool endpointsCached = true;
+ if(object)
+ {
+ DirectReferencePtr odr = DirectReferencePtr::dynamicCast(object->__reference());
+ if(odr)
+ {
+ endpointsCached = false;
+ endpoints = odr->getEndpoints();
+ }
+ else
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ assert(oir);
+ if(!oir->getAdapterId().empty())
+ {
+ endpoints = getEndpoints(oir, endpointsCached);
+ }
+ }
+ }
+
+ if(!objectCached && !endpoints.empty())
+ {
+ _table->addProxy(ref->getIdentity(), object);
+ }
+
+ cached = objectCached || endpointsCached;
+ }
}
catch(const AdapterNotFoundException&)
{
@@ -352,10 +352,10 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
out << "adapter = " << ref->getAdapterId();
}
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object adapter";
- ex.id = ref->getAdapterId();
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object adapter";
+ ex.id = ref->getAdapterId();
+ throw ex;
}
catch(const ObjectNotFoundException&)
{
@@ -367,32 +367,32 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
}
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object";
- ex.id = ref->getInstance()->identityToString(ref->getIdentity());
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object";
+ ex.id = ref->getInstance()->identityToString(ref->getIdentity());
+ throw ex;
}
catch(const NotRegisteredException&)
{
- throw;
+ throw;
}
catch(const LocalException& ex)
{
- if(ref->getInstance()->traceLevels()->location >= 1)
- {
- Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
- out << "couldn't contact the locator to retrieve adapter endpoints\n";
- if(!ref)
- {
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
- }
- else
- {
- out << "adapter = " << ref->getAdapterId() << "\n";
- }
- out << "reason = " << ex.toString();
- }
- throw;
+ if(ref->getInstance()->traceLevels()->location >= 1)
+ {
+ Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
+ out << "couldn't contact the locator to retrieve adapter endpoints\n";
+ if(!ref)
+ {
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
+ }
+ else
+ {
+ out << "adapter = " << ref->getAdapterId() << "\n";
+ }
+ out << "reason = " << ex.toString();
+ }
+ throw;
}
if(ref->getInstance()->traceLevels()->location >= 1)
@@ -433,25 +433,25 @@ IceInternal::LocatorInfo::clearObjectCache(const IndirectReferencePtr& ref)
{
if(ref->getAdapterId().empty())
{
- ObjectPrx object = _table->removeProxy(ref->getIdentity());
- if(object)
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- if(oir)
- {
- if(!oir->getAdapterId().empty())
- {
- clearCache(oir);
- }
- }
- else
- {
- if(ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
- }
- }
- }
+ ObjectPrx object = _table->removeProxy(ref->getIdentity());
+ if(object)
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ if(oir)
+ {
+ if(!oir->getAdapterId().empty())
+ {
+ clearCache(oir);
+ }
+ }
+ else
+ {
+ if(ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
+ }
+ }
+ }
}
}
@@ -460,51 +460,51 @@ IceInternal::LocatorInfo::clearCache(const IndirectReferencePtr& ref)
{
if(!ref->getAdapterId().empty())
{
- vector<EndpointPtr> endpoints = _table->removeAdapterEndpoints(ref->getAdapterId());
+ vector<EndpointPtr> endpoints = _table->removeAdapterEndpoints(ref->getAdapterId());
- if(!endpoints.empty() && ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, endpoints);
- }
+ if(!endpoints.empty() && ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, endpoints);
+ }
}
else
{
- ObjectPrx object = _table->removeProxy(ref->getIdentity());
- if(object)
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- if(oir)
- {
- if(!oir->getAdapterId().empty())
- {
- clearCache(oir);
- }
- }
- else
- {
- if(ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
- }
- }
- }
+ ObjectPrx object = _table->removeProxy(ref->getIdentity());
+ if(object)
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ if(oir)
+ {
+ if(!oir->getAdapterId().empty())
+ {
+ clearCache(oir);
+ }
+ }
+ else
+ {
+ if(ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
+ }
+ }
+ }
}
}
void
IceInternal::LocatorInfo::trace(const string& msg,
- const IndirectReferencePtr& ref,
- const vector<EndpointPtr>& endpoints)
+ const IndirectReferencePtr& ref,
+ const vector<EndpointPtr>& endpoints)
{
Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
out << msg << "\n";
if(!ref->getAdapterId().empty())
{
- out << "adapter = " << ref->getAdapterId() << "\n";
+ out << "adapter = " << ref->getAdapterId() << "\n";
}
else
{
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
}
const char* sep = endpoints.size() > 1 ? ":" : "";
diff --git a/cppe/src/IceE/LoggerI.cpp b/cppe/src/IceE/LoggerI.cpp
index f0ad2390f0d..ac09b256e03 100644
--- a/cppe/src/IceE/LoggerI.cpp
+++ b/cppe/src/IceE/LoggerI.cpp
@@ -20,7 +20,7 @@ Ice::LoggerI::LoggerI(const string& prefix)
{
if(!prefix.empty())
{
- _prefix = prefix + ": ";
+ _prefix = prefix + ": ";
}
}
@@ -45,8 +45,8 @@ Ice::LoggerI::trace(const string& category, const string& message)
string::size_type idx = 0;
while((idx = s.find("\n", idx)) != string::npos)
{
- s.insert(idx + 1, " ");
- ++idx;
+ s.insert(idx + 1, " ");
+ ++idx;
}
IceUtil::StaticMutex::Lock sync(globalMutex);
diff --git a/cppe/src/IceE/LoggerUtil.cpp b/cppe/src/IceE/LoggerUtil.cpp
index 0f59e4374ad..2dabf999fce 100644
--- a/cppe/src/IceE/LoggerUtil.cpp
+++ b/cppe/src/IceE/LoggerUtil.cpp
@@ -29,7 +29,7 @@ Ice::Print::flush()
{
if(!_str.empty())
{
- _logger->print(_str);
+ _logger->print(_str);
}
_str = "";;
}
@@ -55,7 +55,7 @@ Ice::Warning::flush()
{
if(!_str.empty())
{
- _logger->warning(_str);
+ _logger->warning(_str);
}
_str = "";
}
@@ -81,7 +81,7 @@ Ice::Error::flush()
{
if(!_str.empty())
{
- _logger->error(_str);
+ _logger->error(_str);
}
_str = "";
}
@@ -108,7 +108,7 @@ Ice::Trace::flush()
{
if(!_str.empty())
{
- _logger->trace(_category, _str);
+ _logger->trace(_category, _str);
}
_str = "";
}
diff --git a/cppe/src/IceE/Network.cpp b/cppe/src/IceE/Network.cpp
index 10d022bce57..c06e9f99251 100644
--- a/cppe/src/IceE/Network.cpp
+++ b/cppe/src/IceE/Network.cpp
@@ -161,7 +161,7 @@ IceInternal::connectionLost()
errno == ENOTCONN ||
errno == ESHUTDOWN ||
errno == ECONNABORTED ||
- errno == EPIPE;
+ errno == EPIPE;
#endif
}
@@ -183,9 +183,9 @@ IceInternal::createSocket()
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if(fd == INVALID_SOCKET)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
setTcpNoDelay(fd);
@@ -215,18 +215,18 @@ IceInternal::closeSocket(SOCKET fd)
int error = WSAGetLastError();
if(closesocket(fd) == SOCKET_ERROR)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
WSASetLastError(error);
#else
int error = errno;
if(close(fd) == SOCKET_ERROR)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
errno = error;
#endif
@@ -237,29 +237,29 @@ IceInternal::shutdownSocketWrite(SOCKET fd)
{
if(shutdown(fd, SHUT_WR) == SOCKET_ERROR)
{
- //
- // Ignore errors indicating that we are shutdown already.
- //
+ //
+ // Ignore errors indicating that we are shutdown already.
+ //
#if defined(_WIN32)
- int error = WSAGetLastError();
- if(error == WSAENOTCONN)
- {
- return;
- }
+ int error = WSAGetLastError();
+ if(error == WSAENOTCONN)
+ {
+ return;
+ }
#elif defined(__APPLE__)
- if(errno == ENOTCONN || errno == EINVAL)
- {
- return;
- }
+ if(errno == ENOTCONN || errno == EINVAL)
+ {
+ return;
+ }
#else
- if(errno == ENOTCONN)
- {
- return;
- }
+ if(errno == ENOTCONN)
+ {
+ return;
+ }
#endif
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -268,30 +268,30 @@ IceInternal::shutdownSocketReadWrite(SOCKET fd)
{
if(shutdown(fd, SHUT_RDWR) == SOCKET_ERROR)
{
- //
- // Ignore errors indicating that we are shutdown already.
- //
+ //
+ // Ignore errors indicating that we are shutdown already.
+ //
#if defined(_WIN32)
- int error = WSAGetLastError();
- if(error == WSAENOTCONN)
- {
- return;
- }
+ int error = WSAGetLastError();
+ if(error == WSAENOTCONN)
+ {
+ return;
+ }
#elif defined(__APPLE__)
- if(errno == ENOTCONN || errno == EINVAL)
- {
- return;
- }
+ if(errno == ENOTCONN || errno == EINVAL)
+ {
+ return;
+ }
#else
- if(errno == ENOTCONN)
- {
- return;
- }
+ if(errno == ENOTCONN)
+ {
+ return;
+ }
#endif
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -301,46 +301,46 @@ IceInternal::setBlock(SOCKET fd, bool block)
if(block)
{
#ifdef _WIN32
- unsigned long arg = 0;
- if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
+ unsigned long arg = 0;
+ if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
}
#else
- int flags = fcntl(fd, F_GETFL);
- flags &= ~O_NONBLOCK;
- if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
+ int flags = fcntl(fd, F_GETFL);
+ flags &= ~O_NONBLOCK;
+ if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = errno;
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = errno;
+ throw ex;
}
#endif
}
else
{
#ifdef _WIN32
- unsigned long arg = 1;
- if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
+ unsigned long arg = 1;
+ if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
}
#else
- int flags = fcntl(fd, F_GETFL);
- flags |= O_NONBLOCK;
- if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
+ int flags = fcntl(fd, F_GETFL);
+ flags |= O_NONBLOCK;
+ if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = errno;
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = errno;
+ throw ex;
}
#endif
}
@@ -361,10 +361,10 @@ IceInternal::setTimeout(SOCKET fd, bool recv, int timeout)
if(setsockopt(fd, SOL_SOCKET, recv ? SO_RCVTIMEO : SO_SNDTIMEO, (char*)&tt, (int)sizeof(int)) == SOCKET_ERROR)
#endif
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
#endif
@@ -375,10 +375,10 @@ IceInternal::setTcpNoDelay(SOCKET fd)
int flag = 1;
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -388,10 +388,10 @@ IceInternal::setKeepAlive(SOCKET fd)
int flag = 1;
if(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -467,10 +467,10 @@ IceInternal::doBind(SOCKET fd, struct sockaddr_in& addr)
{
if(bind(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
socklen_t len = static_cast<socklen_t>(sizeof(addr));
@@ -495,188 +495,188 @@ IceInternal::doConnect(SOCKET fd, struct sockaddr_in& addr, int timeout)
WSAEVENT event = WSACreateEvent();
if(event == 0)
{
- closeSocketNoThrow(fd);
+ closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
}
if(WSAEventSelect(fd, event, FD_CONNECT) == SOCKET_ERROR)
{
- int error = WSAGetLastError();
+ int error = WSAGetLastError();
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
}
#endif
repeatConnect:
if(::connect(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeatConnect;
- }
-
- if(connectInProgress())
- {
- int val;
+ if(interrupted())
+ {
+ goto repeatConnect;
+ }
+
+ if(connectInProgress())
+ {
+ int val;
#ifdef _WIN32
- WSAEVENT events[1];
- events[0] = event;
- long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
- DWORD rc = WSAWaitForMultipleEvents(1, events, FALSE, tout, FALSE);
- if(rc == WSA_WAIT_FAILED)
- {
- int error = WSAGetLastError();
-
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
- }
-
- if(rc == WSA_WAIT_TIMEOUT)
- {
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- assert(timeout >= 0);
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- assert(rc == WSA_WAIT_EVENT_0);
-
- WSANETWORKEVENTS nevents;
- if(WSAEnumNetworkEvents(fd, event, &nevents) == SOCKET_ERROR)
- {
- int error = WSAGetLastError();
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
- }
-
- //
- // This is necessary to be able to set the socket in blocking mode.
- //
- if(WSAEventSelect(fd, event, 0) == SOCKET_ERROR)
- {
- int error = WSAGetLastError();
-
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
- }
-
- //
- // Now we close the event, because we're finished and
- // this code be repeated.
- //
- WSACloseEvent(event);
-
- assert(nevents.lNetworkEvents & FD_CONNECT);
- val = nevents.iErrorCode[FD_CONNECT_BIT];
+ WSAEVENT events[1];
+ events[0] = event;
+ long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
+ DWORD rc = WSAWaitForMultipleEvents(1, events, FALSE, tout, FALSE);
+ if(rc == WSA_WAIT_FAILED)
+ {
+ int error = WSAGetLastError();
+
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
+ }
+
+ if(rc == WSA_WAIT_TIMEOUT)
+ {
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ assert(timeout >= 0);
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ assert(rc == WSA_WAIT_EVENT_0);
+
+ WSANETWORKEVENTS nevents;
+ if(WSAEnumNetworkEvents(fd, event, &nevents) == SOCKET_ERROR)
+ {
+ int error = WSAGetLastError();
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
+ }
+
+ //
+ // This is necessary to be able to set the socket in blocking mode.
+ //
+ if(WSAEventSelect(fd, event, 0) == SOCKET_ERROR)
+ {
+ int error = WSAGetLastError();
+
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
+ }
+
+ //
+ // Now we close the event, because we're finished and
+ // this code be repeated.
+ //
+ WSACloseEvent(event);
+
+ assert(nevents.lNetworkEvents & FD_CONNECT);
+ val = nevents.iErrorCode[FD_CONNECT_BIT];
#else
repeatPoll:
struct pollfd pollFd[1];
pollFd[0].fd = fd;
pollFd[0].events = POLLOUT;
int ret = ::poll(pollFd, 1, timeout);
- if(ret == 0)
- {
- closeSocketNoThrow(fd);
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- else if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatPoll;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
+ if(ret == 0)
+ {
+ closeSocketNoThrow(fd);
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ else if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatPoll;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
//
// Strange windows bug: The following call to Sleep() is
// necessary, otherwise no error is reported through
// getsockopt.
//
//Sleep(0);
- socklen_t len = static_cast<socklen_t>(sizeof(int));
- if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ socklen_t len = static_cast<socklen_t>(sizeof(int));
+ if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
#endif
- if(val > 0)
- {
- closeSocketNoThrow(fd);
+ if(val > 0)
+ {
+ closeSocketNoThrow(fd);
#ifdef _WIN32
- WSASetLastError(val);
+ WSASetLastError(val);
#else
- errno = val;
+ errno = val;
#endif
- if(connectionRefused())
- {
- ConnectionRefusedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else if(connectFailed())
- {
- ConnectFailedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- return;
- }
+ if(connectionRefused())
+ {
+ ConnectionRefusedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ return;
+ }
- closeSocketNoThrow(fd);
- if(connectionRefused())
- {
- ConnectionRefusedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else if(connectFailed())
- {
- ConnectFailedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ closeSocketNoThrow(fd);
+ if(connectionRefused())
+ {
+ ConnectionRefusedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
}
}
@@ -692,59 +692,59 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
{
#ifdef _WIN32
- //
- // Windows XP has getaddrinfo(), but we don't want to require XP to run IceE.
- //
-
- //
- // gethostbyname() is thread safe on Windows, with a separate hostent per thread
- //
- struct hostent* entry;
- int retry = 5;
- do
- {
- entry = gethostbyname(host.c_str());
- }
- while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
-
- if(entry == 0)
- {
- DNSException ex(__FILE__, __LINE__);
-
- ex.error = WSAGetLastError();
- ex.host = host;
- throw ex;
- }
- memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
+ //
+ // Windows XP has getaddrinfo(), but we don't want to require XP to run IceE.
+ //
+
+ //
+ // gethostbyname() is thread safe on Windows, with a separate hostent per thread
+ //
+ struct hostent* entry;
+ int retry = 5;
+ do
+ {
+ entry = gethostbyname(host.c_str());
+ }
+ while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
+
+ if(entry == 0)
+ {
+ DNSException ex(__FILE__, __LINE__);
+
+ ex.error = WSAGetLastError();
+ ex.host = host;
+ throw ex;
+ }
+ memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
#else
- struct addrinfo* info = 0;
- int retry = 5;
-
- struct addrinfo hints = { 0 };
- hints.ai_family = PF_INET;
-
- int rs = 0;
- do
- {
- rs = getaddrinfo(host.c_str(), 0, &hints, &info);
- }
- while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
-
- if(rs != 0)
- {
- DNSException ex(__FILE__, __LINE__);
- ex.error = rs;
- ex.host = host;
- throw ex;
- }
-
- assert(info->ai_family == PF_INET);
- struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
-
- addr.sin_addr.s_addr = sin->sin_addr.s_addr;
- freeaddrinfo(info);
+ struct addrinfo* info = 0;
+ int retry = 5;
+
+ struct addrinfo hints = { 0 };
+ hints.ai_family = PF_INET;
+
+ int rs = 0;
+ do
+ {
+ rs = getaddrinfo(host.c_str(), 0, &hints, &info);
+ }
+ while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
+
+ if(rs != 0)
+ {
+ DNSException ex(__FILE__, __LINE__);
+ ex.error = rs;
+ ex.host = host;
+ throw ex;
+ }
+
+ assert(info->ai_family == PF_INET);
+ struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
+
+ addr.sin_addr.s_addr = sin->sin_addr.s_addr;
+ freeaddrinfo(info);
#endif
}
@@ -765,24 +765,24 @@ IceInternal::errorToString(int error)
#ifndef _WIN32_WCE
if(error < WSABASEERR)
{
- LPVOID lpMsgBuf = 0;
- DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
- if(ok)
- {
- LPCTSTR msg = (LPCTSTR)lpMsgBuf;
- assert(msg && strlen((const char*)msg) > 0);
- string result = (const char*)msg;
- LocalFree(lpMsgBuf);
- return result;
- }
+ LPVOID lpMsgBuf = 0;
+ DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR)&lpMsgBuf,
+ 0,
+ NULL);
+ if(ok)
+ {
+ LPCTSTR msg = (LPCTSTR)lpMsgBuf;
+ assert(msg && strlen((const char*)msg) > 0);
+ string result = (const char*)msg;
+ LocalFree(lpMsgBuf);
+ return result;
+ }
}
#endif
@@ -826,17 +826,17 @@ IceInternal::fdToString(SOCKET fd)
{
if(fd == INVALID_SOCKET)
{
- return "<closed>";
+ return "<closed>";
}
socklen_t localLen = static_cast<socklen_t>(sizeof(struct sockaddr_in));
struct sockaddr_in localAddr;
if(getsockname(fd, reinterpret_cast<struct sockaddr*>(&localAddr), &localLen) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
bool peerNotConnected = false;
@@ -844,17 +844,17 @@ IceInternal::fdToString(SOCKET fd)
struct sockaddr_in remoteAddr;
if(getpeername(fd, reinterpret_cast<struct sockaddr*>(&remoteAddr), &remoteLen) == SOCKET_ERROR)
{
- if(notConnected())
- {
- peerNotConnected = true;
- }
- else
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ if(notConnected())
+ {
+ peerNotConnected = true;
+ }
+ else
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
}
string s;
@@ -862,12 +862,12 @@ IceInternal::fdToString(SOCKET fd)
s += addrToString(localAddr);
if(peerNotConnected)
{
- s += "\nremote address = <not connected>";
+ s += "\nremote address = <not connected>";
}
else
{
- s += "\nremote address = ";
- s += addrToString(remoteAddr);
+ s += "\nremote address = ";
+ s += addrToString(remoteAddr);
}
return s;
}
@@ -889,7 +889,7 @@ IceInternal::acceptInterrupted()
{
if(interrupted())
{
- return true;
+ return true;
}
#ifdef _WIN32
@@ -912,14 +912,14 @@ IceInternal::doAccept(SOCKET fd)
repeatAccept:
if((ret = ::accept(fd, 0, 0)) == INVALID_SOCKET)
{
- if(acceptInterrupted())
- {
- goto repeatAccept;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ if(acceptInterrupted())
+ {
+ goto repeatAccept;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
setTcpNoDelay(ret);
@@ -933,15 +933,15 @@ IceInternal::doListen(SOCKET fd, int backlog)
repeatListen:
if(::listen(fd, backlog) == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeatListen;
- }
-
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ if(interrupted())
+ {
+ goto repeatListen;
+ }
+
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -989,7 +989,7 @@ IceInternal::getLocalHosts()
for (int i = 0; i < addrs->iAddressCount; ++i)
{
result.push_back(
- inetAddrToString(reinterpret_cast<struct sockaddr_in*>(addrs->Address[i].lpSockaddr)->sin_addr));
+ inetAddrToString(reinterpret_cast<struct sockaddr_in*>(addrs->Address[i].lpSockaddr)->sin_addr));
}
//
diff --git a/cppe/src/IceE/Object.cpp b/cppe/src/IceE/Object.cpp
index df169ea057e..025db36ba10 100644
--- a/cppe/src/IceE/Object.cpp
+++ b/cppe/src/IceE/Object.cpp
@@ -126,31 +126,31 @@ DispatchStatus
Ice::Object::__dispatch(Incoming& in, const Current& current)
{
pair<string*, string*> r =
- equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation);
+ equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation);
if(r.first == r.second)
{
- throw OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
- }
+ throw OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
+ }
switch(r.first - __all)
{
case 0:
{
- return ___ice_id(in, current);
+ return ___ice_id(in, current);
}
case 1:
{
- return ___ice_ids(in, current);
+ return ___ice_ids(in, current);
}
case 2:
- {
- return ___ice_isA(in, current);
- }
- case 3:
- {
- return ___ice_ping(in, current);
- }
+ {
+ return ___ice_isA(in, current);
+ }
+ case 3:
+ {
+ return ___ice_ping(in, current);
+ }
}
assert(false);
@@ -163,13 +163,13 @@ operationModeToString(OperationMode mode)
switch(mode)
{
case Normal:
- return "::Ice::Normal";
+ return "::Ice::Normal";
case Nonmutating:
- return "::Ice::Nonmutating";
+ return "::Ice::Nonmutating";
case Idempotent:
- return "::Ice::Idempotent";
+ return "::Ice::Idempotent";
}
return "???";
@@ -182,22 +182,22 @@ Ice::Object::__invalidMode(OperationMode expected, OperationMode received)
if(expected == Idempotent && received == Nonmutating)
{
- //
- // Fine: typically an old client still using the deprecated nonmutating keyword
- //
-
- //
- // Note that expected == Nonmutating and received == Idempotent is not ok:
- // the server may still use the deprecated nonmutating keyword to detect updates
- // and the client should not break this (deprecated) feature.
- //
+ //
+ // Fine: typically an old client still using the deprecated nonmutating keyword
+ //
+
+ //
+ // Note that expected == Nonmutating and received == Idempotent is not ok:
+ // the server may still use the deprecated nonmutating keyword to detect updates
+ // and the client should not break this (deprecated) feature.
+ //
}
else
{
- Ice::MarshalException ex(__FILE__, __LINE__);
- ex.reason = Ice::printfToString("unexpected operation mode. expected = %s received = %s",
- operationModeToString(expected), operationModeToString(received));
- throw ex;
+ Ice::MarshalException ex(__FILE__, __LINE__);
+ ex.reason = Ice::printfToString("unexpected operation mode. expected = %s received = %s",
+ operationModeToString(expected), operationModeToString(received));
+ throw ex;
}
}
@@ -212,10 +212,10 @@ Ice::Blobject::__dispatch(Incoming& in, const Current& current)
in.os()->writeBlob(outParams);
if(ok)
{
- return DispatchOK;
+ return DispatchOK;
}
else
{
- return DispatchUserException;
+ return DispatchUserException;
}
}
diff --git a/cppe/src/IceE/ObjectAdapter.cpp b/cppe/src/IceE/ObjectAdapter.cpp
index 2148ecc74bb..a67f4b59a71 100644
--- a/cppe/src/IceE/ObjectAdapter.cpp
+++ b/cppe/src/IceE/ObjectAdapter.cpp
@@ -67,80 +67,80 @@ Ice::ObjectAdapter::activate()
bool printAdapterReady = false;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- checkForDeactivation();
-
- //
- // If the one off initializations of the adapter are already
- // done, we just need to activate the incoming connection
- // factories and we're done.
- //
- if(_activateOneOffDone)
- {
- for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::activate));
- return;
- }
-
- //
- // One off initializations of the adapter: update the locator
- // registry and print the "adapter ready" message. We set the
- // _waitForActivate flag to prevent deactivation from other
- // threads while these one off initializations are done.
- //
- _waitForActivate = true;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ checkForDeactivation();
+
+ //
+ // If the one off initializations of the adapter are already
+ // done, we just need to activate the incoming connection
+ // factories and we're done.
+ //
+ if(_activateOneOffDone)
+ {
+ for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ Ice::voidMemFun(&IncomingConnectionFactory::activate));
+ return;
+ }
+
+ //
+ // One off initializations of the adapter: update the locator
+ // registry and print the "adapter ready" message. We set the
+ // _waitForActivate flag to prevent deactivation from other
+ // threads while these one off initializations are done.
+ //
+ _waitForActivate = true;
#ifdef ICEE_HAS_LOCATOR
- locatorInfo = _locatorInfo;
+ locatorInfo = _locatorInfo;
#endif
- printAdapterReady = _instance->initializationData().properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0;
+ printAdapterReady = _instance->initializationData().properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0;
}
#ifdef ICEE_HAS_LOCATOR
try
{
- Ice::Identity dummy;
- dummy.name = "dummy";
- updateLocatorRegistry(locatorInfo, createDirectProxy(dummy));
+ Ice::Identity dummy;
+ dummy.name = "dummy";
+ updateLocatorRegistry(locatorInfo, createDirectProxy(dummy));
}
catch(const Ice::LocalException&)
{
- //
- // If we couldn't update the locator registry, we let the
- // exception go through and don't activate the adapter to
- // allow to user code to retry activating the adapter
- // later.
- //
- {
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- _waitForActivate = false;
- notifyAll();
- }
- throw;
+ //
+ // If we couldn't update the locator registry, we let the
+ // exception go through and don't activate the adapter to
+ // allow to user code to retry activating the adapter
+ // later.
+ //
+ {
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ _waitForActivate = false;
+ notifyAll();
+ }
+ throw;
}
#endif
if(printAdapterReady)
{
- printf("%s ready\n", _name.c_str());
- fflush(stdout);
+ printf("%s ready\n", _name.c_str());
+ fflush(stdout);
}
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- assert(!_deactivated); // Not possible if _waitForActivate = true;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ assert(!_deactivated); // Not possible if _waitForActivate = true;
- //
- // Signal threads waiting for the activation.
- //
- _waitForActivate = false;
- notifyAll();
+ //
+ // Signal threads waiting for the activation.
+ //
+ _waitForActivate = false;
+ notifyAll();
- _activateOneOffDone = true;
+ _activateOneOffDone = true;
- for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::activate));
+ for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ Ice::voidMemFun(&IncomingConnectionFactory::activate));
}
}
@@ -150,9 +150,9 @@ Ice::ObjectAdapter::hold()
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
checkForDeactivation();
-
+
for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::hold));
+ Ice::voidMemFun(&IncomingConnectionFactory::hold));
}
void
@@ -163,7 +163,7 @@ Ice::ObjectAdapter::waitForHold()
checkForDeactivation();
for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::constVoidMemFun(&IncomingConnectionFactory::waitUntilHolding));
+ Ice::constVoidMemFun(&IncomingConnectionFactory::waitUntilHolding));
}
void
@@ -176,25 +176,25 @@ Ice::ObjectAdapter::deactivate()
#endif
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- //
- // Ignore deactivation requests if the object adapter has already
- // been deactivated.
- //
- if(_deactivated)
- {
- return;
- }
-
- //
- // Wait for activation to complete. This is necessary to not
- // get out of order locator updates.
- //
- while(_waitForActivate)
- {
- wait();
- }
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ //
+ // Ignore deactivation requests if the object adapter has already
+ // been deactivated.
+ //
+ if(_deactivated)
+ {
+ return;
+ }
+
+ //
+ // Wait for activation to complete. This is necessary to not
+ // get out of order locator updates.
+ //
+ while(_waitForActivate)
+ {
+ wait();
+ }
#ifdef ICEE_HAS_ROUTER
if(_routerInfo)
@@ -212,27 +212,27 @@ Ice::ObjectAdapter::deactivate()
#endif
incomingConnectionFactories = _incomingConnectionFactories;
- outgoingConnectionFactory = _instance->outgoingConnectionFactory();
+ outgoingConnectionFactory = _instance->outgoingConnectionFactory();
#ifdef ICEE_HAS_LOCATOR
- locatorInfo = _locatorInfo;
+ locatorInfo = _locatorInfo;
#endif
- _deactivated = true;
-
- notifyAll();
+ _deactivated = true;
+
+ notifyAll();
}
#ifdef ICEE_HAS_LOCATOR
try
{
- updateLocatorRegistry(locatorInfo, 0);
+ updateLocatorRegistry(locatorInfo, 0);
}
catch(const Ice::LocalException&)
{
- //
- // We can't throw exceptions in deactivate so we ignore
- // failures to update the locator registry.
- //
+ //
+ // We can't throw exceptions in deactivate so we ignore
+ // failures to update the locator registry.
+ //
}
#endif
@@ -242,7 +242,7 @@ Ice::ObjectAdapter::deactivate()
// message.
//
for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::destroy));
+ Ice::voidMemFun(&IncomingConnectionFactory::destroy));
//
// Must be called outside the thread synchronization, because
@@ -523,8 +523,8 @@ Ice::ObjectAdapter::createReverseProxy(const Identity& ident) const
vector<IncomingConnectionFactoryPtr>::const_iterator p;
for(p = _incomingConnectionFactories.begin(); p != _incomingConnectionFactories.end(); ++p)
{
- list<ConnectionPtr> cons = (*p)->connections();
- copy(cons.begin(), cons.end(), back_inserter(connections));
+ list<ConnectionPtr> cons = (*p)->connections();
+ copy(cons.begin(), cons.end(), back_inserter(connections));
}
//
@@ -533,7 +533,7 @@ Ice::ObjectAdapter::createReverseProxy(const Identity& ident) const
//
vector<EndpointPtr> endpoints;
ReferencePtr ref = _instance->referenceFactory()->create(ident, Ice::Context(), "", ReferenceModeTwoway,
- connections);
+ connections);
return _instance->proxyFactory()->referenceToProxy(ref);
}
@@ -554,8 +554,8 @@ Ice::ObjectAdapter::flushBatchRequests()
{
vector<IncomingConnectionFactoryPtr> f;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- f = _incomingConnectionFactories;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ f = _incomingConnectionFactories;
}
for_each(f.begin(), f.end(), Ice::voidMemFun(&IncomingConnectionFactory::flushBatchRequests));
}
@@ -583,7 +583,7 @@ Ice::ObjectAdapter::decDirectCount()
assert(_directCount > 0);
if(--_directCount == 0)
{
- notifyAll();
+ notifyAll();
}
}
@@ -597,12 +597,12 @@ Ice::ObjectAdapter::getServantManager() const
}
Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const CommunicatorPtr& communicator,
- const ObjectAdapterFactoryPtr& objectAdapterFactory,
- const string& name, const string& endpointInfo
+ const ObjectAdapterFactoryPtr& objectAdapterFactory,
+ const string& name, const string& endpointInfo
#ifdef ICEE_HAS_ROUTER
- , const RouterPrx& router
+ , const RouterPrx& router
#endif
- ) :
+ ) :
_deactivated(false),
_instance(instance),
_communicator(communicator),
@@ -670,36 +670,36 @@ Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const Communicato
//
_instance->outgoingConnectionFactory()->setRouterInfo(_routerInfo);
}
- }
- else
+ }
+ else
#endif
- {
- //
- // Parse the endpoints, but don't store them in the adapter.
- // The connection factory might change it, for example, to
- // fill in the real port number.
- //
- vector<EndpointPtr> endpoints = parseEndpoints(endpointInfo);
- for(vector<EndpointPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
- {
- _incomingConnectionFactories.push_back(new IncomingConnectionFactory(_instance, *p, this));
- }
- if(endpoints.empty())
- {
- TraceLevelsPtr tl = _instance->traceLevels();
- if(tl->network >= 2)
- {
- Trace out(_instance->initializationData().logger, tl->networkCat);
- out << "created adapter `" << name << "' without endpoints";
- }
- }
-
- //
- // Parse published endpoints. These are used in proxies
- // instead of the connection factory endpoints.
- //
- string endpts = _instance->initializationData().properties->getProperty(name + ".PublishedEndpoints");
- _publishedEndpoints = parseEndpoints(endpts);
+ {
+ //
+ // Parse the endpoints, but don't store them in the adapter.
+ // The connection factory might change it, for example, to
+ // fill in the real port number.
+ //
+ vector<EndpointPtr> endpoints = parseEndpoints(endpointInfo);
+ for(vector<EndpointPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
+ {
+ _incomingConnectionFactories.push_back(new IncomingConnectionFactory(_instance, *p, this));
+ }
+ if(endpoints.empty())
+ {
+ TraceLevelsPtr tl = _instance->traceLevels();
+ if(tl->network >= 2)
+ {
+ Trace out(_instance->initializationData().logger, tl->networkCat);
+ out << "created adapter `" << name << "' without endpoints";
+ }
+ }
+
+ //
+ // Parse published endpoints. These are used in proxies
+ // instead of the connection factory endpoints.
+ //
+ string endpts = _instance->initializationData().properties->getProperty(name + ".PublishedEndpoints");
+ _publishedEndpoints = parseEndpoints(endpts);
if(_publishedEndpoints.empty())
{
transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
@@ -711,26 +711,26 @@ Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const Communicato
//
_publishedEndpoints.erase(remove_if(_publishedEndpoints.begin(), _publishedEndpoints.end(),
not1(Ice::constMemFun(&Endpoint::publish))), _publishedEndpoints.end());
- }
+ }
#ifdef ICEE_HAS_LOCATOR
- string locator = _instance->initializationData().properties->getProperty(_name + ".Locator");
- if(!locator.empty())
- {
- setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(locator)));
- }
- else
- {
- setLocator(_instance->referenceFactory()->getDefaultLocator());
- }
+ string locator = _instance->initializationData().properties->getProperty(_name + ".Locator");
+ if(!locator.empty())
+ {
+ setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(locator)));
+ }
+ else
+ {
+ setLocator(_instance->referenceFactory()->getDefaultLocator());
+ }
#endif
}
catch(...)
{
- deactivate();
- waitForDeactivate();
- __setNoDelete(false);
- throw;
+ deactivate();
+ waitForDeactivate();
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
}
@@ -739,21 +739,21 @@ Ice::ObjectAdapter::~ObjectAdapter()
{
if(!_deactivated)
{
- Warning out(_instance->initializationData().logger);
- out << "object adapter `" << _name << "' has not been deactivated";
+ Warning out(_instance->initializationData().logger);
+ out << "object adapter `" << _name << "' has not been deactivated";
}
else if(!_destroyed)
{
- Warning out(_instance->initializationData().logger);
- out << "object adapter `" << _name << "' has not been destroyed";
+ Warning out(_instance->initializationData().logger);
+ out << "object adapter `" << _name << "' has not been destroyed";
}
else
{
- //assert(!_servantManager); // We don't clear this reference, it needs to be immutable.
- assert(!_communicator);
- assert(_incomingConnectionFactories.empty());
- assert(_directCount == 0);
- assert(!_waitForActivate);
+ //assert(!_servantManager); // We don't clear this reference, it needs to be immutable.
+ assert(!_communicator);
+ assert(_incomingConnectionFactories.empty());
+ assert(_directCount == 0);
+ assert(!_waitForActivate);
}
}
@@ -764,16 +764,16 @@ Ice::ObjectAdapter::newProxy(const Identity& ident, const string& facet) const
if(_id.empty())
{
#endif
- return newDirectProxy(ident, facet);
+ return newDirectProxy(ident, facet);
#ifdef ICEE_HAS_LOCATOR
}
else if(_replicaGroupId.empty())
{
- return newIndirectProxy(ident, facet, _id);
+ return newIndirectProxy(ident, facet, _id);
}
else
{
- return newIndirectProxy(ident, facet, _replicaGroupId);
+ return newIndirectProxy(ident, facet, _replicaGroupId);
}
#endif
}
@@ -797,10 +797,10 @@ Ice::ObjectAdapter::newDirectProxy(const Identity& ident, const string& facet) c
//
#ifdef ICEE_HAS_ROUTER
ReferencePtr ref = _instance->referenceFactory()->create(ident, Ice::Context(), facet, ReferenceModeTwoway,
- false, endpoints, 0);
+ false, endpoints, 0);
#else
ReferencePtr ref = _instance->referenceFactory()->create(ident, Ice::Context(), facet, ReferenceModeTwoway,
- false, endpoints);
+ false, endpoints);
#endif
return _instance->proxyFactory()->referenceToProxy(ref);
@@ -816,11 +816,11 @@ Ice::ObjectAdapter::newIndirectProxy(const Identity& ident, const string& facet,
#ifdef ICEE_HAS_ROUTER
ReferencePtr ref =
_instance->referenceFactory()->create(ident, Ice::Context(), facet, ReferenceModeTwoway, false, id, 0,
- _locatorInfo);
+ _locatorInfo);
#else
ReferencePtr ref =
_instance->referenceFactory()->create(ident, Ice::Context(), facet, ReferenceModeTwoway, false, id,
- _locatorInfo);
+ _locatorInfo);
#endif
//
@@ -835,9 +835,9 @@ Ice::ObjectAdapter::checkForDeactivation() const
{
if(_deactivated)
{
- ObjectAdapterDeactivatedException ex(__FILE__, __LINE__);
- ex.name = _name;
- throw ex;
+ ObjectAdapterDeactivatedException ex(__FILE__, __LINE__);
+ ex.name = _name;
+ throw ex;
}
}
@@ -864,38 +864,38 @@ Ice::ObjectAdapter::parseEndpoints(const string& str) const
vector<EndpointPtr> endpoints;
while(end < endpts.length())
{
- const string delim = " \t\n\r";
-
- beg = endpts.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = endpts.find(':', beg);
- if(end == string::npos)
- {
- end = endpts.length();
- }
-
- if(end == beg)
- {
- ++end;
- continue;
- }
-
- string s = endpts.substr(beg, end - beg);
- EndpointPtr endp = _instance->endpointFactory()->create(s);
- if(endp == 0)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = s;
- throw ex;
- }
+ const string delim = " \t\n\r";
+
+ beg = endpts.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = endpts.find(':', beg);
+ if(end == string::npos)
+ {
+ end = endpts.length();
+ }
+
+ if(end == beg)
+ {
+ ++end;
+ continue;
+ }
+
+ string s = endpts.substr(beg, end - beg);
+ EndpointPtr endp = _instance->endpointFactory()->create(s);
+ if(endp == 0)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = s;
+ throw ex;
+ }
vector<EndpointPtr> endps = endp->expand(true);
endpoints.insert(endpoints.end(), endps.begin(), endps.end());
- ++end;
+ ++end;
}
return endpoints;
@@ -907,7 +907,7 @@ ObjectAdapter::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locatorI
{
if(_id.empty())
{
- return; // Nothing to update.
+ return; // Nothing to update.
}
//
@@ -924,42 +924,42 @@ ObjectAdapter::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locatorI
LocatorRegistryPrx locatorRegistry = locatorInfo ? locatorInfo->getLocatorRegistry() : LocatorRegistryPrx();
if(!locatorRegistry)
{
- return;
+ return;
}
if(!_id.empty())
{
- try
- {
- if(_replicaGroupId.empty())
- {
- locatorRegistry->setAdapterDirectProxy(_id, proxy);
- }
- else
- {
- locatorRegistry->setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
- }
- }
- catch(const AdapterNotFoundException&)
- {
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object adapter";
- ex.id = _id;
- throw ex;
- }
- catch(const InvalidReplicaGroupIdException&)
- {
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "replica group";
- ex.id = _replicaGroupId;
- throw ex;
- }
- catch(const AdapterAlreadyActiveException&)
- {
- ObjectAdapterIdInUseException ex(__FILE__, __LINE__);
- ex.id = _id;
- throw ex;
- }
+ try
+ {
+ if(_replicaGroupId.empty())
+ {
+ locatorRegistry->setAdapterDirectProxy(_id, proxy);
+ }
+ else
+ {
+ locatorRegistry->setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
+ }
+ }
+ catch(const AdapterNotFoundException&)
+ {
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object adapter";
+ ex.id = _id;
+ throw ex;
+ }
+ catch(const InvalidReplicaGroupIdException&)
+ {
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "replica group";
+ ex.id = _replicaGroupId;
+ throw ex;
+ }
+ catch(const AdapterAlreadyActiveException&)
+ {
+ ObjectAdapterIdInUseException ex(__FILE__, __LINE__);
+ ex.id = _id;
+ throw ex;
+ }
}
}
#endif
diff --git a/cppe/src/IceE/ObjectAdapterFactory.cpp b/cppe/src/IceE/ObjectAdapterFactory.cpp
index b2a23adbfeb..e53feb3be0c 100644
--- a/cppe/src/IceE/ObjectAdapterFactory.cpp
+++ b/cppe/src/IceE/ObjectAdapterFactory.cpp
@@ -24,23 +24,23 @@ IceInternal::ObjectAdapterFactory::shutdown()
map<string, ObjectAdapterPtr> adapters;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // Ignore shutdown requests if the object adapter factory has
- // already been shut down.
- //
- if(!_instance)
- {
- return;
- }
-
- adapters = _adapters;
-
- _instance = 0;
- _communicator = 0;
-
- notifyAll();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // Ignore shutdown requests if the object adapter factory has
+ // already been shut down.
+ //
+ if(!_instance)
+ {
+ return;
+ }
+
+ adapters = _adapters;
+
+ _instance = 0;
+ _communicator = 0;
+
+ notifyAll();
}
//
@@ -48,10 +48,10 @@ IceInternal::ObjectAdapterFactory::shutdown()
// deadlocks.
//
//for_each(adapters.begin(), adapters.end(),
- //Ice::secondVoidMemFun<const string, ObjectAdapter>(&ObjectAdapter::deactivate));
+ //Ice::secondVoidMemFun<const string, ObjectAdapter>(&ObjectAdapter::deactivate));
for(map<string, ObjectAdapterPtr>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
- p->second->deactivate();
+ p->second->deactivate();
}
}
@@ -60,25 +60,25 @@ void
IceInternal::ObjectAdapterFactory::waitForShutdown()
{
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait for the shutdown of the factory itself.
- //
- while(_instance)
- {
- wait();
- }
-
- //
- // If some other thread is currently shutting down, we wait
- // until this thread is finished.
- //
- while(_waitForShutdown)
- {
- wait();
- }
- _waitForShutdown = true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait for the shutdown of the factory itself.
+ //
+ while(_instance)
+ {
+ wait();
+ }
+
+ //
+ // If some other thread is currently shutting down, we wait
+ // until this thread is finished.
+ //
+ while(_waitForShutdown)
+ {
+ wait();
+ }
+ _waitForShutdown = true;
}
//
@@ -86,17 +86,17 @@ IceInternal::ObjectAdapterFactory::waitForShutdown()
//
for(map<string, ObjectAdapterPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
{
- p->second->waitForDeactivate();
+ p->second->waitForDeactivate();
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- //
- // Signal that waiting is complete.
- //
- _waitForShutdown = false;
- notifyAll();
+ //
+ // Signal that waiting is complete.
+ //
+ _waitForShutdown = false;
+ notifyAll();
}
}
@@ -130,35 +130,35 @@ IceInternal::ObjectAdapterFactory::destroy()
//
for(map<string, ObjectAdapterPtr>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
- p->second->destroy();
+ p->second->destroy();
}
}
ObjectAdapterPtr
IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const string& endpoints
#ifdef ICEE_HAS_ROUTER
- , const RouterPrx& router
+ , const RouterPrx& router
#endif
- )
+ )
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(!_instance)
{
- throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
+ throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
map<string, ObjectAdapterPtr>::iterator p = _adapters.find(name);
if(p != _adapters.end())
{
- throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
+ throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
}
ObjectAdapterPtr adapter = new ObjectAdapter(_instance, _communicator, this, name, endpoints
#ifdef ICEE_HAS_ROUTER
- , router
+ , router
#endif
- );
+ );
_adapters.insert(make_pair(name, adapter));
return adapter;
}
@@ -182,7 +182,7 @@ struct FlushAdapter
{
void operator() (ObjectAdapterPtr p)
{
- p->flushBatchRequests();
+ p->flushBatchRequests();
}
};
@@ -193,18 +193,18 @@ IceInternal::ObjectAdapterFactory::flushBatchRequests() const
{
list<ObjectAdapterPtr> a;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- for(map<string, ObjectAdapterPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
- {
- a.push_back(p->second);
- }
+ for(map<string, ObjectAdapterPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
+ {
+ a.push_back(p->second);
+ }
}
for_each(a.begin(), a.end(), FlushAdapter());
}
IceInternal::ObjectAdapterFactory::ObjectAdapterFactory(const InstancePtr& instance,
- const CommunicatorPtr& communicator) :
+ const CommunicatorPtr& communicator) :
_instance(instance),
_communicator(communicator),
_waitForShutdown(false)
diff --git a/cppe/src/IceE/ObjectAdapterFactory.h b/cppe/src/IceE/ObjectAdapterFactory.h
index 8bf700c5d84..5bf7be7bc6b 100644
--- a/cppe/src/IceE/ObjectAdapterFactory.h
+++ b/cppe/src/IceE/ObjectAdapterFactory.h
@@ -36,9 +36,9 @@ public:
::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&, const std::string&
#ifdef ICEE_HAS_ROUTER
- , const ::Ice::RouterPrx&
+ , const ::Ice::RouterPrx&
#endif
- );
+ );
void removeObjectAdapter(const std::string&);
void flushBatchRequests() const;
diff --git a/cppe/src/IceE/Outgoing.cpp b/cppe/src/IceE/Outgoing.cpp
index 2bf572dfab2..19b7d9a07ee 100644
--- a/cppe/src/IceE/Outgoing.cpp
+++ b/cppe/src/IceE/Outgoing.cpp
@@ -45,7 +45,7 @@ IceInternal::LocalExceptionWrapper::retry() const
}
IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const string& operation,
- OperationMode mode, const Context* context) :
+ OperationMode mode, const Context* context) :
_connection(connection),
_reference(ref),
_state(StateUnsent),
@@ -58,26 +58,26 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
{
switch(_reference->getMode())
{
- case ReferenceModeTwoway:
- case ReferenceModeOneway:
- {
- _stream.writeBlob(requestHdr, sizeof(requestHdr));
- break;
- }
+ case ReferenceModeTwoway:
+ case ReferenceModeOneway:
+ {
+ _stream.writeBlob(requestHdr, sizeof(requestHdr));
+ break;
+ }
- case ReferenceModeBatchOneway:
+ case ReferenceModeBatchOneway:
#ifdef ICEE_HAS_BATCH
- {
- _connection->prepareBatchRequest(&_stream);
- break;
- }
+ {
+ _connection->prepareBatchRequest(&_stream);
+ break;
+ }
#endif
- case ReferenceModeDatagram:
- case ReferenceModeBatchDatagram:
- {
- assert(false);
- break;
- }
+ case ReferenceModeDatagram:
+ case ReferenceModeBatchDatagram:
+ {
+ assert(false);
+ break;
+ }
}
// _reference->getIdentity().__write(&_stream);
@@ -91,12 +91,12 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
//
if(_reference->getFacet().empty())
{
- _stream.writeSize(0);
+ _stream.writeSize(0);
}
else
{
- _stream.writeSize(1);
- _stream.write(_reference->getFacet());
+ _stream.writeSize(1);
+ _stream.write(_reference->getFacet());
}
_stream.write(operation, false);
@@ -112,8 +112,8 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
Context::const_iterator p;
for(p = context->begin(); p != context->end(); ++p)
{
- _stream.write(p->first);
- _stream.write(p->second);
+ _stream.write(p->first);
+ _stream.write(p->second);
}
//
@@ -134,86 +134,86 @@ IceInternal::Outgoing::invoke()
switch(_reference->getMode())
{
- case ReferenceModeTwoway:
- {
- //
- // We let all exceptions raised by sending directly
- // propagate to the caller, because they can be retried
- // without violating "at-most-once". In case of such
- // exceptions, the connection object does not call back on
- // this object, so we don't need to lock the mutex, keep
- // track of state, or save exceptions.
- //
- _connection->sendRequest(&_stream, this);
+ case ReferenceModeTwoway:
+ {
+ //
+ // We let all exceptions raised by sending directly
+ // propagate to the caller, because they can be retried
+ // without violating "at-most-once". In case of such
+ // exceptions, the connection object does not call back on
+ // this object, so we don't need to lock the mutex, keep
+ // track of state, or save exceptions.
+ //
+ _connection->sendRequest(&_stream, this);
- if(_exception.get())
- {
- //
- // A CloseConnectionException indicates graceful
- // server shutdown, and is therefore always repeatable
- // without violating "at-most-once". That's because by
- // sending a close connection message, the server
- // guarantees that all outstanding requests can safely
- // be repeated.
- //
- // An ObjectNotExistException can always be retried as
- // well without violating "at-most-once".
- //
- if(dynamic_cast<CloseConnectionException*>(_exception.get()) ||
- dynamic_cast<ObjectNotExistException*>(_exception.get()))
- {
- _exception->ice_throw();
- }
-
- //
- // Throw the exception wrapped in a LocalExceptionWrapper, to
- // indicate that the request cannot be resent without
- // potentially violating the "at-most-once" principle.
- //
- throw LocalExceptionWrapper(*_exception.get(), false);
- }
-
- if(_state == StateUserException)
- {
- return false;
- }
+ if(_exception.get())
+ {
+ //
+ // A CloseConnectionException indicates graceful
+ // server shutdown, and is therefore always repeatable
+ // without violating "at-most-once". That's because by
+ // sending a close connection message, the server
+ // guarantees that all outstanding requests can safely
+ // be repeated.
+ //
+ // An ObjectNotExistException can always be retried as
+ // well without violating "at-most-once".
+ //
+ if(dynamic_cast<CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<ObjectNotExistException*>(_exception.get()))
+ {
+ _exception->ice_throw();
+ }
+
+ //
+ // Throw the exception wrapped in a LocalExceptionWrapper, to
+ // indicate that the request cannot be resent without
+ // potentially violating the "at-most-once" principle.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), false);
+ }
+
+ if(_state == StateUserException)
+ {
+ return false;
+ }
- assert(_state == StateOK);
- break;
- }
-
- case ReferenceModeOneway:
- {
- //
- // For oneway requests, the connection object
- // never calls back on this object. Therefore we don't
- // need to lock the mutex or save exceptions. We simply
- // let all exceptions from sending propagate to the
- // caller, because such exceptions can be retried without
- // violating "at-most-once".
- //
- _connection->sendRequest(&_stream, 0);
- break;
- }
+ assert(_state == StateOK);
+ break;
+ }
+
+ case ReferenceModeOneway:
+ {
+ //
+ // For oneway requests, the connection object
+ // never calls back on this object. Therefore we don't
+ // need to lock the mutex or save exceptions. We simply
+ // let all exceptions from sending propagate to the
+ // caller, because such exceptions can be retried without
+ // violating "at-most-once".
+ //
+ _connection->sendRequest(&_stream, 0);
+ break;
+ }
- case ReferenceModeBatchOneway:
+ case ReferenceModeBatchOneway:
#ifdef ICEE_HAS_BATCH
- {
- //
- // For batch oneways, the same rules as for
- // regular oneways (see comment above)
- // apply.
- //
- _connection->finishBatchRequest(&_stream);
- break;
- }
+ {
+ //
+ // For batch oneways, the same rules as for
+ // regular oneways (see comment above)
+ // apply.
+ //
+ _connection->finishBatchRequest(&_stream);
+ break;
+ }
#endif
- case ReferenceModeDatagram:
- case ReferenceModeBatchDatagram:
- {
- assert(false);
- return false;
- }
+ case ReferenceModeDatagram:
+ case ReferenceModeBatchDatagram:
+ {
+ assert(false);
+ return false;
+ }
}
return true;
@@ -232,14 +232,14 @@ IceInternal::Outgoing::abort(const LocalException& ex)
#ifdef ICEE_HAS_BATCH
if(_reference->getMode() == ReferenceModeBatchOneway)
{
- _connection->abortBatchRequest();
-
- //
- // If we abort a batch requests, we cannot retry, because not
- // only the batch request that caused the problem will be
- // aborted, but all other requests in the batch as well.
- //
- throw LocalExceptionWrapper(ex, false);
+ _connection->abortBatchRequest();
+
+ //
+ // If we abort a batch requests, we cannot retry, because not
+ // only the batch request that caused the problem will be
+ // aborted, but all other requests in the batch as well.
+ //
+ throw LocalExceptionWrapper(ex, false);
}
#endif
@@ -257,7 +257,7 @@ IceInternal::Outgoing::finished(BasicStream& is)
//
if(&is != &_stream)
{
- _stream.swap(is);
+ _stream.swap(is);
}
Byte replyStatus;
@@ -265,153 +265,153 @@ IceInternal::Outgoing::finished(BasicStream& is)
switch(replyStatus)
{
- case replyOK:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _stream.startReadEncaps();
- _state = StateOK; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyUserException:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _stream.startReadEncaps();
- _state = StateUserException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyObjectNotExist:
- case replyFacetNotExist:
- case replyOperationNotExist:
- {
- //
- // Don't read the exception members directly into the
- // exception. Otherwise if reading fails and raises an
- // exception, you will have a memory leak.
- //
- Identity ident;
- ident.__read(&_stream);
+ case replyOK:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _stream.startReadEncaps();
+ _state = StateOK; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyUserException:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _stream.startReadEncaps();
+ _state = StateUserException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyObjectNotExist:
+ case replyFacetNotExist:
+ case replyOperationNotExist:
+ {
+ //
+ // Don't read the exception members directly into the
+ // exception. Otherwise if reading fails and raises an
+ // exception, you will have a memory leak.
+ //
+ Identity ident;
+ ident.__read(&_stream);
- //
- // For compatibility with the old FacetPath.
- //
- vector<string> facetPath;
- _stream.read(facetPath);
- string facet;
- if(!facetPath.empty())
- {
- if(facetPath.size() > 1)
- {
- throw MarshalException(__FILE__, __LINE__);
- }
- facet.swap(facetPath[0]);
- }
+ //
+ // For compatibility with the old FacetPath.
+ //
+ vector<string> facetPath;
+ _stream.read(facetPath);
+ string facet;
+ if(!facetPath.empty())
+ {
+ if(facetPath.size() > 1)
+ {
+ throw MarshalException(__FILE__, __LINE__);
+ }
+ facet.swap(facetPath[0]);
+ }
- string operation;
- _stream.read(operation, false);
-
- RequestFailedException* ex;
- switch(replyStatus)
- {
- case replyObjectNotExist:
- {
- ex = new ObjectNotExistException(__FILE__, __LINE__);
- break;
- }
-
- case replyFacetNotExist:
- {
- ex = new FacetNotExistException(__FILE__, __LINE__);
- break;
- }
-
- case replyOperationNotExist:
- {
- ex = new OperationNotExistException(__FILE__, __LINE__);
- break;
- }
-
- default:
- {
- ex = 0; // To keep the compiler from complaining.
- assert(false);
- break;
- }
- }
-
- ex->id = ident;
- ex->facet = facet;
- ex->operation = operation;
- _exception.reset(ex);
+ string operation;
+ _stream.read(operation, false);
+
+ RequestFailedException* ex;
+ switch(replyStatus)
+ {
+ case replyObjectNotExist:
+ {
+ ex = new ObjectNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyFacetNotExist:
+ {
+ ex = new FacetNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyOperationNotExist:
+ {
+ ex = new OperationNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ default:
+ {
+ ex = 0; // To keep the compiler from complaining.
+ assert(false);
+ break;
+ }
+ }
+
+ ex->id = ident;
+ ex->facet = facet;
+ ex->operation = operation;
+ _exception.reset(ex);
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyUnknownException:
- case replyUnknownLocalException:
- case replyUnknownUserException:
- {
- //
- // Don't read the exception members directly into the
- // exception. Otherwise if reading fails and raises an
- // exception, you will have a memory leak.
- //
- string unknown;
- _stream.read(unknown, false);
-
- UnknownException* ex;
- switch(replyStatus)
- {
- case replyUnknownException:
- {
- ex = new UnknownException(__FILE__, __LINE__);
- break;
- }
-
- case replyUnknownLocalException:
- {
- ex = new UnknownLocalException(__FILE__, __LINE__);
- break;
- }
-
- case replyUnknownUserException:
- {
- ex = new UnknownUserException(__FILE__, __LINE__);
- break;
- }
-
- default:
- {
- ex = 0; // To keep the compiler from complaining.
- assert(false);
- break;
- }
- }
-
- ex->unknown = unknown;
- _exception.reset(ex);
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyUnknownException:
+ case replyUnknownLocalException:
+ case replyUnknownUserException:
+ {
+ //
+ // Don't read the exception members directly into the
+ // exception. Otherwise if reading fails and raises an
+ // exception, you will have a memory leak.
+ //
+ string unknown;
+ _stream.read(unknown, false);
+
+ UnknownException* ex;
+ switch(replyStatus)
+ {
+ case replyUnknownException:
+ {
+ ex = new UnknownException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyUnknownLocalException:
+ {
+ ex = new UnknownLocalException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyUnknownUserException:
+ {
+ ex = new UnknownUserException(__FILE__, __LINE__);
+ break;
+ }
+
+ default:
+ {
+ ex = 0; // To keep the compiler from complaining.
+ assert(false);
+ break;
+ }
+ }
+
+ ex->unknown = unknown;
+ _exception.reset(ex);
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- default:
- {
- //_exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
- _exception.reset(new ProtocolException(__FILE__, __LINE__, "unknown reply status"));
- _state = StateLocalException;
- break;
- }
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ default:
+ {
+ //_exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
+ _exception.reset(new ProtocolException(__FILE__, __LINE__, "unknown reply status"));
+ _state = StateLocalException;
+ break;
+ }
}
}
diff --git a/cppe/src/IceE/OutgoingConnectionFactory.cpp b/cppe/src/IceE/OutgoingConnectionFactory.cpp
index 5c86c452c77..79b3696c73c 100644
--- a/cppe/src/IceE/OutgoingConnectionFactory.cpp
+++ b/cppe/src/IceE/OutgoingConnectionFactory.cpp
@@ -36,18 +36,18 @@ IceInternal::OutgoingConnectionFactory::destroy()
if(_destroyed)
{
- return;
+ return;
}
#ifdef _STLP_BEGIN_NAMESPACE
// voidbind2nd is an STLport extension for broken compilers in IceE/Functional.h
for_each(_connections.begin(), _connections.end(),
- voidbind2nd(Ice::secondVoidMemFun1<EndpointPtr, Connection, Connection::DestructionReason>
- (&Connection::destroy), Connection::CommunicatorDestroyed));
+ voidbind2nd(Ice::secondVoidMemFun1<EndpointPtr, Connection, Connection::DestructionReason>
+ (&Connection::destroy), Connection::CommunicatorDestroyed));
#else
for_each(_connections.begin(), _connections.end(),
- bind2nd(Ice::secondVoidMemFun1<const EndpointPtr, Connection, Connection::DestructionReason>
- (&Connection::destroy), Connection::CommunicatorDestroyed));
+ bind2nd(Ice::secondVoidMemFun1<const EndpointPtr, Connection, Connection::DestructionReason>
+ (&Connection::destroy), Connection::CommunicatorDestroyed));
#endif
_destroyed = true;
@@ -60,27 +60,27 @@ IceInternal::OutgoingConnectionFactory::waitUntilFinished()
multimap<EndpointPtr, ConnectionPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the factory is destroyed. We also wait
- // until there are no pending connections anymore. Only then
- // we can be sure the _connections contains all connections.
- //
- while(!_destroyed || !_pending.empty())
- {
- wait();
- }
-
- //
- // We want to wait until all connections are finished outside the
- // thread synchronization.
- //
- connections.swap(_connections);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the factory is destroyed. We also wait
+ // until there are no pending connections anymore. Only then
+ // we can be sure the _connections contains all connections.
+ //
+ while(!_destroyed || !_pending.empty())
+ {
+ wait();
+ }
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ connections.swap(_connections);
}
for_each(connections.begin(), connections.end(),
- Ice::secondVoidMemFun<const EndpointPtr, Connection>(&Connection::waitUntilFinished));
+ Ice::secondVoidMemFun<const EndpointPtr, Connection>(&Connection::waitUntilFinished));
}
ConnectionPtr
@@ -90,130 +90,130 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
vector<EndpointPtr> endpoints = endpts;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(_destroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
-
- //
- // Reap connections for which destruction has completed.
- //
- std::multimap<EndpointPtr, ConnectionPtr>::iterator p = _connections.begin();
- while(p != _connections.end())
- {
- if(p->second->isFinished())
- {
- _connections.erase(p++);
- }
- else
- {
- ++p;
- }
- }
-
- //
- // Modify endpoints with overrides.
- //
- vector<EndpointPtr>::iterator q;
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- if(_instance->defaultsAndOverrides()->overrideTimeout)
- {
- *q = (*q)->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
- }
- }
-
- //
- // Search for existing connections.
- //
- vector<EndpointPtr>::const_iterator r;
- for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
- {
- pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
-
- while(pr.first != pr.second)
- {
- //
- // Don't return connections for which destruction has
- // been initiated.
- //
- if(!pr.first->second->isDestroyed())
- {
- return pr.first->second;
- }
-
- ++pr.first;
- }
- }
-
- //
- // If some other thread is currently trying to establish a
- // connection to any of our endpoints, we wait until this
- // thread is finished.
- //
- bool searchAgain = false;
- while(!_destroyed)
- {
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- if(_pending.find(*q) != _pending.end())
- {
- break;
- }
- }
-
- if(q == endpoints.end())
- {
- break;
- }
-
- searchAgain = true;
-
- wait();
- }
-
- if(_destroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
-
- //
- // Search for existing connections again if we waited above,
- // as new connections might have been added in the meantime.
- //
- if(searchAgain)
- {
- for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
- {
- pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
-
- while(pr.first != pr.second)
- {
- //
- // Don't return connections for which destruction has
- // been initiated.
- //
- if(!pr.first->second->isDestroyed())
- {
- return pr.first->second;
- }
-
- ++pr.first;
- }
- }
- }
-
- //
- // No connection to any of our endpoints exists yet, so we
- // will try to create one. To avoid that other threads try to
- // create connections to the same endpoints, we add our
- // endpoints to _pending.
- //
- _pending.insert(endpoints.begin(), endpoints.end());
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(_destroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ std::multimap<EndpointPtr, ConnectionPtr>::iterator p = _connections.begin();
+ while(p != _connections.end())
+ {
+ if(p->second->isFinished())
+ {
+ _connections.erase(p++);
+ }
+ else
+ {
+ ++p;
+ }
+ }
+
+ //
+ // Modify endpoints with overrides.
+ //
+ vector<EndpointPtr>::iterator q;
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ if(_instance->defaultsAndOverrides()->overrideTimeout)
+ {
+ *q = (*q)->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ }
+ }
+
+ //
+ // Search for existing connections.
+ //
+ vector<EndpointPtr>::const_iterator r;
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
+ {
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
+
+ while(pr.first != pr.second)
+ {
+ //
+ // Don't return connections for which destruction has
+ // been initiated.
+ //
+ if(!pr.first->second->isDestroyed())
+ {
+ return pr.first->second;
+ }
+
+ ++pr.first;
+ }
+ }
+
+ //
+ // If some other thread is currently trying to establish a
+ // connection to any of our endpoints, we wait until this
+ // thread is finished.
+ //
+ bool searchAgain = false;
+ while(!_destroyed)
+ {
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ if(_pending.find(*q) != _pending.end())
+ {
+ break;
+ }
+ }
+
+ if(q == endpoints.end())
+ {
+ break;
+ }
+
+ searchAgain = true;
+
+ wait();
+ }
+
+ if(_destroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
+ //
+ // Search for existing connections again if we waited above,
+ // as new connections might have been added in the meantime.
+ //
+ if(searchAgain)
+ {
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
+ {
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
+
+ while(pr.first != pr.second)
+ {
+ //
+ // Don't return connections for which destruction has
+ // been initiated.
+ //
+ if(!pr.first->second->isDestroyed())
+ {
+ return pr.first->second;
+ }
+
+ ++pr.first;
+ }
+ }
+ }
+
+ //
+ // No connection to any of our endpoints exists yet, so we
+ // will try to create one. To avoid that other threads try to
+ // create connections to the same endpoints, we add our
+ // endpoints to _pending.
+ //
+ _pending.insert(endpoints.begin(), endpoints.end());
}
ConnectionPtr connection;
@@ -223,104 +223,104 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
vector<EndpointPtr>::const_iterator r;
for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
{
- EndpointPtr endpoint = *q;
-
- try
- {
- ConnectorPtr connector = endpoint->connector();
- assert(connector);
-
- Int timeout;
- if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
- {
- timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
- }
- // It is not necessary to check for overrideTimeout,
- // the endpoint has already been modified with this
- // override, if set.
- else
- {
- timeout = endpoint->timeout();
- }
-
- TransceiverPtr transceiver = connector->connect(timeout);
- assert(transceiver);
+ EndpointPtr endpoint = *q;
+
+ try
+ {
+ ConnectorPtr connector = endpoint->connector();
+ assert(connector);
+
+ Int timeout;
+ if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
+ {
+ timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
+ }
+ // It is not necessary to check for overrideTimeout,
+ // the endpoint has already been modified with this
+ // override, if set.
+ else
+ {
+ timeout = endpoint->timeout();
+ }
+
+ TransceiverPtr transceiver = connector->connect(timeout);
+ assert(transceiver);
#ifdef ICEE_PURE_CLIENT
- connection = new Connection(_instance, transceiver, endpoint);
+ connection = new Connection(_instance, transceiver, endpoint);
#else
- connection = new Connection(_instance, transceiver, endpoint, 0);
+ connection = new Connection(_instance, transceiver, endpoint, 0);
#endif
- //
- // Wait for the connection to be validated by the
- // connection thread. Once the connection has been
- // validated it will be activated also.
- //
- connection->waitForValidation();
- break;
- }
- catch(const LocalException& ex)
- {
- exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
-
- //
- // If a connection object was constructed, then validate()
- // must have raised the exception.
- //
- if(connection)
- {
- connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
- connection = 0;
- }
- }
-
- TraceLevelsPtr traceLevels = _instance->traceLevels();
- if(traceLevels->retry >= 2)
- {
- Trace out(_instance->initializationData().logger, traceLevels->retryCat);
-
- out << "connection to endpoint failed";
- if(q + 1 != endpoints.end())
- {
- out << ", trying next endpoint\n";
- }
- else
- {
- out << " and no more endpoints to try\n";
- }
- out << (*exception.get()).toString();
- }
+ //
+ // Wait for the connection to be validated by the
+ // connection thread. Once the connection has been
+ // validated it will be activated also.
+ //
+ connection->waitForValidation();
+ break;
+ }
+ catch(const LocalException& ex)
+ {
+ exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+
+ //
+ // If a connection object was constructed, then validate()
+ // must have raised the exception.
+ //
+ if(connection)
+ {
+ connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ connection = 0;
+ }
+ }
+
+ TraceLevelsPtr traceLevels = _instance->traceLevels();
+ if(traceLevels->retry >= 2)
+ {
+ Trace out(_instance->initializationData().logger, traceLevels->retryCat);
+
+ out << "connection to endpoint failed";
+ if(q + 1 != endpoints.end())
+ {
+ out << ", trying next endpoint\n";
+ }
+ else
+ {
+ out << " and no more endpoints to try\n";
+ }
+ out << (*exception.get()).toString();
+ }
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // Signal other threads that we are done with trying to
- // establish connections to our endpoints.
- //
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- _pending.erase(*q);
- }
- notifyAll();
-
- if(!connection)
- {
- assert(exception.get());
- exception->ice_throw();
- }
- else
- {
- _connections.insert(_connections.end(),
- pair<const EndpointPtr, ConnectionPtr>(connection->endpoint(), connection));
-
- if(_destroyed)
- {
- connection->destroy(Connection::CommunicatorDestroyed);
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // Signal other threads that we are done with trying to
+ // establish connections to our endpoints.
+ //
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ _pending.erase(*q);
+ }
+ notifyAll();
+
+ if(!connection)
+ {
+ assert(exception.get());
+ exception->ice_throw();
+ }
+ else
+ {
+ _connections.insert(_connections.end(),
+ pair<const EndpointPtr, ConnectionPtr>(connection->endpoint(), connection));
+
+ if(_destroyed)
+ {
+ connection->destroy(Connection::CommunicatorDestroyed);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+ }
}
assert(connection);
@@ -336,7 +336,7 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route
if(_destroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
assert(routerInfo);
@@ -353,34 +353,34 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route
vector<EndpointPtr>::const_iterator p;
for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
- EndpointPtr endpoint = *p;
+ EndpointPtr endpoint = *p;
- //
- // Modify endpoints with overrides.
- //
- if(_instance->defaultsAndOverrides()->overrideTimeout)
- {
- endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
- }
+ //
+ // Modify endpoints with overrides.
+ //
+ if(_instance->defaultsAndOverrides()->overrideTimeout)
+ {
+ endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ }
#ifndef ICEE_PURE_CLIENT
- pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(endpoint);
-
- while(pr.first != pr.second)
- {
- try
- {
- pr.first->second->setAdapter(adapter);
- }
- catch(const Ice::LocalException&)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- ++pr.first;
- }
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(endpoint);
+
+ while(pr.first != pr.second)
+ {
+ try
+ {
+ pr.first->second->setAdapter(adapter);
+ }
+ catch(const Ice::LocalException&)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
+ }
+ ++pr.first;
+ }
#endif
}
}
@@ -394,26 +394,26 @@ IceInternal::OutgoingConnectionFactory::flushBatchRequests()
list<ConnectionPtr> c;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- for(std::multimap<EndpointPtr, ConnectionPtr>::const_iterator p = _connections.begin();
- p != _connections.end();
- ++p)
- {
- c.push_back(p->second);
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ for(std::multimap<EndpointPtr, ConnectionPtr>::const_iterator p = _connections.begin();
+ p != _connections.end();
+ ++p)
+ {
+ c.push_back(p->second);
+ }
}
for(list<ConnectionPtr>::const_iterator p = c.begin(); p != c.end(); ++p)
{
- try
- {
- (*p)->flushBatchRequests();
- }
- catch(const LocalException&)
- {
- // Ignore.
- }
+ try
+ {
+ (*p)->flushBatchRequests();
+ }
+ catch(const LocalException&)
+ {
+ // Ignore.
+ }
}
}
#endif
@@ -439,24 +439,24 @@ IceInternal::OutgoingConnectionFactory::removeAdapter(const ObjectAdapterPtr& ad
if(_destroyed)
{
- return;
+ return;
}
for(multimap<EndpointPtr, ConnectionPtr>::const_iterator p = _connections.begin(); p != _connections.end(); ++p)
{
- if(p->second->getAdapter() == adapter)
- {
- try
- {
- p->second->setAdapter(0);
- }
- catch(const Ice::LocalException&)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- }
+ if(p->second->getAdapter() == adapter)
+ {
+ try
+ {
+ p->second->setAdapter(0);
+ }
+ catch(const Ice::LocalException&)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
+ }
+ }
}
}
diff --git a/cppe/src/IceE/Properties.cpp b/cppe/src/IceE/Properties.cpp
index 58e439b7046..c9058e2a932 100644
--- a/cppe/src/IceE/Properties.cpp
+++ b/cppe/src/IceE/Properties.cpp
@@ -27,11 +27,11 @@ Ice::Properties::getProperty(const string& key)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- return p->second;
+ return p->second;
}
else
{
- return string();
+ return string();
}
}
@@ -43,11 +43,11 @@ Ice::Properties::getPropertyWithDefault(const string& key, const string& value)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- return p->second;
+ return p->second;
}
else
{
- return value;
+ return value;
}
}
@@ -65,7 +65,7 @@ Ice::Properties::getPropertyAsIntWithDefault(const string& key, Int value)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- value = atoi(p->second.c_str());
+ value = atoi(p->second.c_str());
}
return value;
@@ -94,7 +94,7 @@ Ice::Properties::setProperty(const string& key, const string& value)
{
if(key.empty())
{
- return;
+ return;
}
IceUtil::Mutex::Lock sync(*this);
@@ -104,11 +104,11 @@ Ice::Properties::setProperty(const string& key, const string& value)
//
if(!value.empty())
{
- _properties[key] = value;
+ _properties[key] = value;
}
else
{
- _properties.erase(key);
+ _properties.erase(key);
}
}
@@ -122,7 +122,7 @@ Ice::Properties::getCommandLineOptions()
map<string, string>::const_iterator p;
for(p = _properties.begin(); p != _properties.end(); ++p)
{
- result.push_back("--" + p->first + "=" + p->second);
+ result.push_back("--" + p->first + "=" + p->second);
}
return result;
}
@@ -133,7 +133,7 @@ Ice::Properties::parseCommandLineOptions(const string& prefix, const StringSeq&
string pfx = prefix;
if(!pfx.empty() && pfx[pfx.size() - 1] != '.')
{
- pfx += '.';
+ pfx += '.';
}
pfx = "--" + pfx;
@@ -176,7 +176,7 @@ Ice::Properties::load(const std::string& file)
if(!in)
{
FileException ex(__FILE__, __LINE__);
- ex.path = file;
+ ex.path = file;
ex.error = getSystemErrno();
throw ex;
}
@@ -184,7 +184,7 @@ Ice::Properties::load(const std::string& file)
char line[1024];
while(fgets(line, 1024, in) != NULL)
{
- parseLine(line
+ parseLine(line
#ifdef ICEE_HAS_WSTRING
, _converter
#endif
@@ -226,7 +226,7 @@ Ice::Properties::Properties(StringSeq& args, const PropertiesPtr& defaults
{
if(defaults != 0)
{
- _properties = defaults->getPropertiesForPrefix("");
+ _properties = defaults->getPropertiesForPrefix("");
}
StringSeq::iterator q = args.begin();
@@ -239,7 +239,7 @@ Ice::Properties::Properties(StringSeq& args, const PropertiesPtr& defaults
//
string name = *q;
replace(name.begin(), name.end(), '\\', '/');
- setProperty("Ice.ProgramName", name);
+ setProperty("Ice.ProgramName", name);
}
StringSeq tmp;
@@ -258,27 +258,27 @@ Ice::Properties::Properties(StringSeq& args, const PropertiesPtr& defaults
, 0
#endif
);
- loadConfigFiles = true;
+ loadConfigFiles = true;
}
else
{
- tmp.push_back(s);
+ tmp.push_back(s);
}
- ++q;
+ ++q;
}
args = tmp;
if(!loadConfigFiles)
{
- //
- // If Ice.Config is not set, load from ICE_CONFIG (if set)
- //
- loadConfigFiles = (_properties.find("Ice.Config") == _properties.end());
+ //
+ // If Ice.Config is not set, load from ICE_CONFIG (if set)
+ //
+ loadConfigFiles = (_properties.find("Ice.Config") == _properties.end());
}
if(loadConfigFiles)
{
- loadConfig();
+ loadConfig();
}
args = parseIceCommandLineOptions(args);
@@ -335,7 +335,11 @@ Ice::Properties::parseLine(const string& line
}
string key = IceUtil::trim(s.substr(0, split));
- string value = IceUtil::trim(s.substr(split + 1, s.length() - split - 1));
+ string value;
+ if(split < s.length() - 2)
+ {
+ value = IceUtil::trim(s.substr(split + 1, s.length() - split - 1));
+ }
#ifdef ICEE_HAS_WSTRING
if(converter)
diff --git a/cppe/src/IceE/Protocol.cpp b/cppe/src/IceE/Protocol.cpp
index 12bfd645fb8..309614511ce 100644
--- a/cppe/src/IceE/Protocol.cpp
+++ b/cppe/src/IceE/Protocol.cpp
@@ -12,7 +12,7 @@
namespace IceInternal
{
-const Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
+const Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
const Ice::Byte requestHdr[] =
{
diff --git a/cppe/src/IceE/Proxy.cpp b/cppe/src/IceE/Proxy.cpp
index 6ba2127a000..af83c170b36 100644
--- a/cppe/src/IceE/Proxy.cpp
+++ b/cppe/src/IceE/Proxy.cpp
@@ -36,8 +36,8 @@ Ice::__write(::IceInternal::BasicStream* __os, const ::Ice::Context& v, ::Ice::_
::Ice::Context::const_iterator p;
for(p = v.begin(); p != v.end(); ++p)
{
- __os->write(p->first);
- __os->write(p->second);
+ __os->write(p->first);
+ __os->write(p->second);
}
}
@@ -48,10 +48,10 @@ Ice::__read(::IceInternal::BasicStream* __is, ::Ice::Context& v, ::Ice::__U__Con
__is->readSize(sz);
while(sz--)
{
- ::std::pair<const ::std::string, ::std::string> pair;
- __is->read(const_cast< ::std::string&>(pair.first));
- ::Ice::Context::iterator __i = v.insert(v.end(), pair);
- __is->read(__i->second);
+ ::std::pair<const ::std::string, ::std::string> pair;
+ __is->read(const_cast< ::std::string&>(pair.first));
+ ::Ice::Context::iterator __i = v.insert(v.end(), pair);
+ __is->read(__i->second);
}
}
@@ -68,23 +68,23 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string&
if(b)
{
- ObjectPrx bb = b->ice_facet(f);
- try
- {
- if(bb->ice_isA(typeId))
- {
- return bb;
- }
+ ObjectPrx bb = b->ice_facet(f);
+ try
+ {
+ if(bb->ice_isA(typeId))
+ {
+ return bb;
+ }
#ifndef NDEBUG
- else
- {
- assert(typeId != "::Ice::Object");
- }
+ else
+ {
+ assert(typeId != "::Ice::Object");
+ }
#endif
- }
- catch(const FacetNotExistException&)
- {
- }
+ }
+ catch(const FacetNotExistException&)
+ {
+ }
}
return 0;
}
@@ -102,23 +102,23 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string&
if(b)
{
- ObjectPrx bb = b->ice_facet(f);
- try
- {
- if(bb->ice_isA(typeId, ctx))
- {
- return bb;
- }
+ ObjectPrx bb = b->ice_facet(f);
+ try
+ {
+ if(bb->ice_isA(typeId, ctx))
+ {
+ return bb;
+ }
#ifndef NDEBUG
- else
- {
- assert(typeId != "::Ice::Object");
- }
+ else
+ {
+ assert(typeId != "::Ice::Object");
+ }
#endif
- }
- catch(const FacetNotExistException&)
- {
- }
+ }
+ catch(const FacetNotExistException&)
+ {
+ }
}
return 0;
}
@@ -160,11 +160,11 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context* __context)
while(true)
{
ConnectionPtr __connection;
- try
- {
- __checkTwowayOnly("ice_isA");
- static const string __operation("ice_isA");
- __connection = ice_getConnection();
+ try
+ {
+ __checkTwowayOnly("ice_isA");
+ static const string __operation("ice_isA");
+ __connection = ice_getConnection();
Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
BasicStream* __stream = __og.stream();
try
@@ -181,14 +181,14 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context* __context)
{
if(!__ok)
{
- try
- {
+ try
+ {
__stream->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
__stream->read(__ret);
}
@@ -203,20 +203,20 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context* __context)
}
#endif
return __ret;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__connection, __ex, __cnt);
- }
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__connection, __ex, __cnt);
+ }
#if defined(_MSC_VER) && defined(_M_ARM) // ARM bug.
- catch(...)
- {
- throw;
- }
+ catch(...)
+ {
+ throw;
+ }
#endif
}
}
@@ -228,10 +228,10 @@ IceProxy::Ice::Object::ice_ping(const Context* __context)
while(true)
{
ConnectionPtr __connection;
- try
- {
+ try
+ {
static const string __operation("ice_ping");
- __connection = ice_getConnection();
+ __connection = ice_getConnection();
Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
bool __ok = __og.invoke();
try
@@ -239,14 +239,14 @@ IceProxy::Ice::Object::ice_ping(const Context* __context)
BasicStream* __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
}
catch(const ::Ice::LocalException& __ex)
@@ -259,21 +259,21 @@ IceProxy::Ice::Object::ice_ping(const Context* __context)
throw;
}
#endif
- return;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__connection, __ex, __cnt);
- }
+ return;
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__connection, __ex, __cnt);
+ }
#if defined(_MSC_VER) && defined(_M_ARM) // ARM bug.
- catch(...)
- {
- throw;
- }
+ catch(...)
+ {
+ throw;
+ }
#endif
}
}
@@ -285,11 +285,11 @@ IceProxy::Ice::Object::ice_ids(const Context* __context)
while(true)
{
ConnectionPtr __connection;
- try
- {
- __checkTwowayOnly("ice_ids");
+ try
+ {
+ __checkTwowayOnly("ice_ids");
static const string __operation("ice_ids");
- __connection = ice_getConnection();
+ __connection = ice_getConnection();
Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
vector<string> __ret;
bool __ok = __og.invoke();
@@ -298,14 +298,14 @@ IceProxy::Ice::Object::ice_ids(const Context* __context)
BasicStream* __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
__is->read(__ret, false);
}
@@ -320,20 +320,20 @@ IceProxy::Ice::Object::ice_ids(const Context* __context)
}
#endif
return __ret;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__connection, __ex, __cnt);
- }
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__connection, __ex, __cnt);
+ }
#if defined(_MSC_VER) && defined(_M_ARM) // ARM bug.
- catch(...)
- {
- throw;
- }
+ catch(...)
+ {
+ throw;
+ }
#endif
}
}
@@ -345,11 +345,11 @@ IceProxy::Ice::Object::ice_id(const Context* __context)
while(true)
{
ConnectionPtr __connection;
- try
- {
- __checkTwowayOnly("ice_id");
+ try
+ {
+ __checkTwowayOnly("ice_id");
static const string __operation("ice_id");
- __connection = ice_getConnection();
+ __connection = ice_getConnection();
Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
string __ret;
bool __ok = __og.invoke();
@@ -358,14 +358,14 @@ IceProxy::Ice::Object::ice_id(const Context* __context)
BasicStream* __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
__is->read(__ret, false);
}
@@ -380,20 +380,20 @@ IceProxy::Ice::Object::ice_id(const Context* __context)
}
#endif
return __ret;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__connection, __ex, __cnt);
- }
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__connection, __ex, __cnt);
+ }
#if defined(_MSC_VER) && defined(_M_ARM) // ARM bug.
- catch(...)
- {
- throw;
- }
+ catch(...)
+ {
+ throw;
+ }
#endif
}
}
@@ -427,13 +427,13 @@ IceProxy::Ice::Object::ice_identity(const Identity& newIdentity) const
}
if(newIdentity == _reference->getIdentity())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeIdentity(newIdentity));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeIdentity(newIdentity));
+ return proxy;
}
}
@@ -448,13 +448,13 @@ IceProxy::Ice::Object::ice_facet(const string& newFacet) const
{
if(newFacet == _reference->getFacet())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeFacet(newFacet));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeFacet(newFacet));
+ return proxy;
}
}
@@ -473,13 +473,13 @@ IceProxy::Ice::Object::ice_router(const RouterPrx& router) const
ReferencePtr ref = _reference->changeRouter(router);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -499,13 +499,13 @@ IceProxy::Ice::Object::ice_adapterId(const string& adapterId) const
ReferencePtr ref = _reference->changeAdapterId(adapterId);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -522,13 +522,13 @@ IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const
ReferencePtr ref = _reference->changeLocator(locator);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -561,13 +561,13 @@ IceProxy::Ice::Object::ice_timeout(int t) const
ReferencePtr ref = _reference->changeTimeout(t);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -610,10 +610,10 @@ IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from)
ConnectionPtr con;
{
- ::IceUtil::Mutex::Lock sync(*from.get());
+ ::IceUtil::Mutex::Lock sync(*from.get());
- ref = from->_reference;
- con = from->_connection;
+ ref = from->_reference;
+ con = from->_connection;
}
//
@@ -645,13 +645,13 @@ IceProxy::Ice::Object::__handleException(const ConnectionPtr& connection, const
ProxyFactoryPtr proxyFactory = _reference->getInstance()->proxyFactory();
if(proxyFactory)
{
- proxyFactory->checkRetryAfterException(ex, _reference, cnt);
+ proxyFactory->checkRetryAfterException(ex, _reference, cnt);
}
else
{
- //
- // The communicator is already destroyed, so we cannot retry.
- //
+ //
+ // The communicator is already destroyed, so we cannot retry.
+ //
ex.ice_throw();
}
}
@@ -703,8 +703,8 @@ IceProxy::Ice::Object::__checkTwowayOnly(const char* name) const
if(!ice_isTwoway())
{
TwowayOnlyException ex(__FILE__, __LINE__);
- ex.operation = name;
- throw ex;
+ ex.operation = name;
+ throw ex;
}
}
@@ -719,13 +719,13 @@ IceProxy::Ice::Object::changeMode(ReferenceMode newMode) const
{
if(_reference->getMode() == newMode)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeMode(newMode));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeMode(newMode));
+ return proxy;
}
}
@@ -734,19 +734,19 @@ Ice::proxyIdentityLess(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return false;
+ return false;
}
else if(!lhs && rhs)
{
- return true;
+ return true;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- return lhs->ice_getIdentity() < rhs->ice_getIdentity();
+ return lhs->ice_getIdentity() < rhs->ice_getIdentity();
}
}
@@ -755,19 +755,19 @@ Ice::proxyIdentityEqual(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return true;
+ return true;
}
else if(!lhs && rhs)
{
- return false;
+ return false;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- return lhs->ice_getIdentity() == rhs->ice_getIdentity();
+ return lhs->ice_getIdentity() == rhs->ice_getIdentity();
}
}
@@ -776,43 +776,43 @@ Ice::proxyIdentityAndFacetLess(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return false;
+ return false;
}
else if(!lhs && rhs)
{
- return true;
+ return true;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- Identity lhsIdentity = lhs->ice_getIdentity();
- Identity rhsIdentity = rhs->ice_getIdentity();
-
- if(lhsIdentity < rhsIdentity)
- {
- return true;
- }
- else if(rhsIdentity < lhsIdentity)
- {
- return false;
- }
-
- string lhsFacet = lhs->ice_getFacet();
- string rhsFacet = rhs->ice_getFacet();
-
- if(lhsFacet < rhsFacet)
- {
- return true;
- }
- else if(rhsFacet < lhsFacet)
- {
- return false;
- }
-
- return false;
+ Identity lhsIdentity = lhs->ice_getIdentity();
+ Identity rhsIdentity = rhs->ice_getIdentity();
+
+ if(lhsIdentity < rhsIdentity)
+ {
+ return true;
+ }
+ else if(rhsIdentity < lhsIdentity)
+ {
+ return false;
+ }
+
+ string lhsFacet = lhs->ice_getFacet();
+ string rhsFacet = rhs->ice_getFacet();
+
+ if(lhsFacet < rhsFacet)
+ {
+ return true;
+ }
+ else if(rhsFacet < lhsFacet)
+ {
+ return false;
+ }
+
+ return false;
}
}
@@ -821,32 +821,32 @@ Ice::proxyIdentityAndFacetEqual(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return true;
+ return true;
}
else if(!lhs && rhs)
{
- return false;
+ return false;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- Identity lhsIdentity = lhs->ice_getIdentity();
- Identity rhsIdentity = rhs->ice_getIdentity();
-
- if(lhsIdentity == rhsIdentity)
- {
- string lhsFacet = lhs->ice_getFacet();
- string rhsFacet = rhs->ice_getFacet();
-
- if(lhsFacet == rhsFacet)
- {
- return true;
- }
- }
-
- return false;
+ Identity lhsIdentity = lhs->ice_getIdentity();
+ Identity rhsIdentity = rhs->ice_getIdentity();
+
+ if(lhsIdentity == rhsIdentity)
+ {
+ string lhsFacet = lhs->ice_getFacet();
+ string rhsFacet = rhs->ice_getFacet();
+
+ if(lhsFacet == rhsFacet)
+ {
+ return true;
+ }
+ }
+
+ return false;
}
}
diff --git a/cppe/src/IceE/ProxyFactory.cpp b/cppe/src/IceE/ProxyFactory.cpp
index 564f40ec857..3ca7b7a2d23 100644
--- a/cppe/src/IceE/ProxyFactory.cpp
+++ b/cppe/src/IceE/ProxyFactory.cpp
@@ -39,11 +39,11 @@ IceInternal::ProxyFactory::proxyToString(const ObjectPrx& proxy) const
{
if(proxy)
{
- return proxy->__reference()->toString();
+ return proxy->__reference()->toString();
}
else
{
- return "";
+ return "";
}
}
@@ -69,13 +69,13 @@ IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, BasicStream* s)
{
if(proxy)
{
- proxy->__reference()->getIdentity().__write(s);
- proxy->__reference()->streamWrite(s);
+ proxy->__reference()->getIdentity().__write(s);
+ proxy->__reference()->streamWrite(s);
}
else
{
- Identity ident;
- ident.__write(s);
+ Identity ident;
+ ident.__write(s);
}
}
@@ -105,15 +105,15 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
if(one)
{
#ifdef ICEE_HAS_LOCATOR
- LocatorInfoPtr li = ref->getLocatorInfo();
- if(li)
- {
- //
- // We retry ObjectNotExistException if the reference is indirect.
- //
- li->clearObjectCache(IndirectReferencePtr::dynamicCast(ref));
- }
- else
+ LocatorInfoPtr li = ref->getLocatorInfo();
+ if(li)
+ {
+ //
+ // We retry ObjectNotExistException if the reference is indirect.
+ //
+ li->clearObjectCache(IndirectReferencePtr::dynamicCast(ref));
+ }
+ else
#endif
#ifdef ICEE_HAS_ROUTER
if(ref->getRouterInfo() && one->operation == "ice_add_proxy")
@@ -133,14 +133,14 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
}
return; // We must always retry, so we don't look at the retry count.
}
- else
+ else
#endif
- {
- //
- // For all other cases, we don't retry ObjectNotExistException
- //
- ex.ice_throw();
- }
+ {
+ //
+ // For all other cases, we don't retry ObjectNotExistException
+ //
+ ex.ice_throw();
+ }
}
else
#endif
@@ -150,7 +150,7 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
// We don't retry other *NotExistException, which are all
// derived from RequestFailedException.
//
- ex.ice_throw();
+ ex.ice_throw();
}
//
@@ -177,7 +177,7 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
//
if(dynamic_cast<const MarshalException*>(&ex))
{
- ex.ice_throw();
+ ex.ice_throw();
}
++cnt;
@@ -225,41 +225,41 @@ IceInternal::ProxyFactory::ProxyFactory(const InstancePtr& instance) :
while(true)
{
- const string delim = " \t";
+ const string delim = " \t";
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- if(_retryIntervals.empty())
- {
- _retryIntervals.push_back(0);
- }
- break;
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ if(_retryIntervals.empty())
+ {
+ _retryIntervals.push_back(0);
+ }
+ break;
+ }
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
-
- if(beg == end)
- {
- break;
- }
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+
+ if(beg == end)
+ {
+ break;
+ }
- string value = str.substr(beg, end - beg);
- int v = atoi(value.c_str());
+ string value = str.substr(beg, end - beg);
+ int v = atoi(value.c_str());
- //
- // If -1 is the first value, no retry and wait intervals.
- //
- if(v == -1 && _retryIntervals.empty())
- {
- break;
- }
+ //
+ // If -1 is the first value, no retry and wait intervals.
+ //
+ if(v == -1 && _retryIntervals.empty())
+ {
+ break;
+ }
- _retryIntervals.push_back(v > 0 ? v : 0);
+ _retryIntervals.push_back(v > 0 ? v : 0);
}
}
diff --git a/cppe/src/IceE/RecMutex.cpp b/cppe/src/IceE/RecMutex.cpp
index 28528f31c4e..bf526d2b8a4 100644
--- a/cppe/src/IceE/RecMutex.cpp
+++ b/cppe/src/IceE/RecMutex.cpp
@@ -34,7 +34,7 @@ IceUtil::RecMutex::lock() const
EnterCriticalSection(&_mutex);
if(++_count > 1)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
}
@@ -43,11 +43,11 @@ IceUtil::RecMutex::tryLock() const
{
if(!TryEnterCriticalSection(&_mutex))
{
- return false;
+ return false;
}
if(++_count > 1)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
return true;
}
@@ -57,7 +57,7 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
}
@@ -84,7 +84,7 @@ IceUtil::RecMutex::RecMutex() :
_mutex = CreateMutex(0, false, 0);
if(_mutex == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -94,7 +94,7 @@ IceUtil::RecMutex::~RecMutex()
BOOL rc = CloseHandle(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -104,23 +104,23 @@ IceUtil::RecMutex::lock() const
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
if(++_count > 1)
{
- BOOL rc2 = ReleaseMutex(_mutex);
- if(rc2 == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc2 = ReleaseMutex(_mutex);
+ if(rc2 == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
}
@@ -130,15 +130,15 @@ IceUtil::RecMutex::tryLock() const
DWORD rc = WaitForSingleObject(_mutex, 0);
if(rc != WAIT_OBJECT_0)
{
- return false;
+ return false;
}
if(++_count > 1)
{
- BOOL rc2 = ReleaseMutex(_mutex);
- if(rc2 == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc2 = ReleaseMutex(_mutex);
+ if(rc2 == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
return true;
}
@@ -148,11 +148,11 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- BOOL rc = ReleaseMutex(_mutex);
- if(rc == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc = ReleaseMutex(_mutex);
+ if(rc == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
}
@@ -164,7 +164,7 @@ IceUtil::RecMutex::unlock(LockState& state) const
BOOL rc = ReleaseMutex(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -174,14 +174,14 @@ IceUtil::RecMutex::lock(LockState& state) const
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
_count = state.count;
@@ -203,19 +203,19 @@ IceUtil::RecMutex::RecMutex() :
rc = pthread_mutexattr_init(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#endif
rc = pthread_mutex_init(&_mutex, &attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#if defined(__linux) && !defined(__USE_UNIX98)
@@ -224,7 +224,7 @@ IceUtil::RecMutex::RecMutex() :
rc = pthread_mutexattr_destroy(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#endif
}
@@ -243,12 +243,12 @@ IceUtil::RecMutex::lock() const
int rc = pthread_mutex_lock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
if(++_count > 1)
{
- rc = pthread_mutex_unlock(&_mutex);
- assert(rc == 0);
+ rc = pthread_mutex_unlock(&_mutex);
+ assert(rc == 0);
}
}
@@ -259,18 +259,18 @@ IceUtil::RecMutex::tryLock() const
bool result = (rc == 0);
if(!result)
{
- if(rc != EBUSY)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ if(rc != EBUSY)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
else if(++_count > 1)
{
- rc = pthread_mutex_unlock(&_mutex);
- if(rc != 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ rc = pthread_mutex_unlock(&_mutex);
+ if(rc != 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
return result;
}
@@ -280,9 +280,9 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- int rc = 0; // Prevent warnings when NDEBUG is defined.
- rc = pthread_mutex_unlock(&_mutex);
- assert(rc == 0);
+ int rc = 0; // Prevent warnings when NDEBUG is defined.
+ rc = pthread_mutex_unlock(&_mutex);
+ assert(rc == 0);
}
}
diff --git a/cppe/src/IceE/Reference.cpp b/cppe/src/IceE/Reference.cpp
index 1b10d06a667..1d780684b61 100644
--- a/cppe/src/IceE/Reference.cpp
+++ b/cppe/src/IceE/Reference.cpp
@@ -78,7 +78,7 @@ IceInternal::Reference::changeMode(ReferenceMode newMode) const
{
if(newMode == _mode)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_mode = newMode;
@@ -90,7 +90,7 @@ IceInternal::Reference::changeSecure(bool newSecure) const
{
if(newSecure == _secure)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_secure = newSecure;
@@ -102,7 +102,7 @@ IceInternal::Reference::changeIdentity(const Identity& newIdentity) const
{
if(newIdentity == _identity)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_identity = newIdentity;
@@ -114,7 +114,7 @@ IceInternal::Reference::changeFacet(const string& newFacet) const
{
if(newFacet == _facet)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_facet = newFacet;
@@ -126,7 +126,7 @@ IceInternal::Reference::changeTimeout(int newTimeout) const
{
if(_overrideTimeout && newTimeout == _timeout)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = getInstance()->referenceFactory()->copy(this);
r->_timeout = newTimeout;
@@ -161,19 +161,19 @@ Reference::hash() const
for(q = _context.begin(); q != _context.end(); ++q)
{
- for(p = q->first.begin(); p != q->first.end(); ++p)
- {
- h = 5 * h + *p;
- }
- for(p = q->second.begin(); p != q->second.end(); ++p)
- {
- h = 5 * h + *p;
- }
+ for(p = q->first.begin(); p != q->first.end(); ++p)
+ {
+ h = 5 * h + *p;
+ }
+ for(p = q->second.begin(); p != q->second.end(); ++p)
+ {
+ h = 5 * h + *p;
+ }
}
for(p = _facet.begin(); p != _facet.end(); ++p)
{
- h = 5 * h + *p;
+ h = 5 * h + *p;
}
h = 5 * h + static_cast<Int>(getSecure());
@@ -197,11 +197,11 @@ IceInternal::Reference::streamWrite(BasicStream* s) const
//
if(_facet.empty())
{
- s->write(static_cast<string*>(0), static_cast<string*>(0));
+ s->write(static_cast<string*>(0), static_cast<string*>(0));
}
else
{
- s->write(&_facet, &_facet + 1);
+ s->write(&_facet, &_facet + 1);
}
s->write(static_cast<Byte>(_mode));
@@ -225,7 +225,7 @@ IceInternal::Reference::toString() const
if(id.find_first_of(" :@") != string::npos)
{
s += "\"";
- s += id;
+ s += id;
s += "\"";
}
else
@@ -237,11 +237,11 @@ IceInternal::Reference::toString() const
{
s += " -f ";
- //
- // If the encoded facet string contains characters which
- // the reference parser uses as separators, then we enclose
- // the facet string in quotes.
- //
+ //
+ // If the encoded facet string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the facet string in quotes.
+ //
string fs = _facet;
#ifdef ICEE_HAS_WSTRING
if(_instance->initializationData().stringConverter)
@@ -252,55 +252,55 @@ IceInternal::Reference::toString() const
fs = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
}
#endif
- fs = IceUtil::escapeString(fs, "");
- if(fs.find_first_of(" :@") != string::npos)
- {
+ fs = IceUtil::escapeString(fs, "");
+ if(fs.find_first_of(" :@") != string::npos)
+ {
s += "\"";
- s += fs;
+ s += fs;
s += "\"";
- }
- else
- {
- s += fs;
- }
+ }
+ else
+ {
+ s += fs;
+ }
}
switch(_mode)
{
- case ReferenceModeTwoway:
- {
- s += " -t";
- break;
- }
-
- case ReferenceModeOneway:
- {
- s += " -o";
- break;
- }
-
- case ReferenceModeBatchOneway:
- {
- s += " -O";
- break;
- }
-
- case ReferenceModeDatagram:
- {
- s += " -d";
- break;
- }
-
- case ReferenceModeBatchDatagram:
- {
- s += " -D";
- break;
- }
+ case ReferenceModeTwoway:
+ {
+ s += " -t";
+ break;
+ }
+
+ case ReferenceModeOneway:
+ {
+ s += " -o";
+ break;
+ }
+
+ case ReferenceModeBatchOneway:
+ {
+ s += " -O";
+ break;
+ }
+
+ case ReferenceModeDatagram:
+ {
+ s += " -d";
+ break;
+ }
+
+ case ReferenceModeBatchDatagram:
+ {
+ s += " -D";
+ break;
+ }
}
if(getSecure())
{
- s += " -s";
+ s += " -s";
}
return s;
@@ -317,37 +317,37 @@ IceInternal::Reference::operator==(const Reference& r) const
if(getType() != r.getType())
{
- return false;
+ return false;
}
if(_mode != r._mode)
{
- return false;
+ return false;
}
if(_secure != r._secure)
{
- return false;
+ return false;
}
if(_identity != r._identity)
{
- return false;
+ return false;
}
if(_context != r._context)
{
- return false;
+ return false;
}
if(_facet != r._facet)
{
- return false;
+ return false;
}
if(_overrideTimeout != r._overrideTimeout || _overrideTimeout && _timeout != r._timeout)
{
- return false;
+ return false;
}
return true;
@@ -362,83 +362,83 @@ IceInternal::Reference::operator<(const Reference& r) const
if(_mode < r._mode)
{
- return true;
+ return true;
}
else if(r._mode < _mode)
{
- return false;
+ return false;
}
if(!_secure && r._secure)
{
- return true;
+ return true;
}
else if(r._secure < _secure)
{
- return false;
+ return false;
}
if(_identity < r._identity)
{
- return true;
+ return true;
}
else if(r._identity < _identity)
{
- return false;
+ return false;
}
if(_context < r._context)
{
- return true;
+ return true;
}
else if(r._context < _context)
{
- return false;
+ return false;
}
if(_facet < r._facet)
{
- return true;
+ return true;
}
else if(r._facet < _facet)
{
- return false;
+ return false;
}
if(!_overrideTimeout && r._overrideTimeout)
{
- return true;
+ return true;
}
else if(r._overrideTimeout < _overrideTimeout)
{
- return false;
+ return false;
}
else if(_overrideTimeout)
{
- if(_timeout < r._timeout)
- {
- return true;
- }
- else if(r._timeout < _timeout)
- {
- return false;
- }
+ if(_timeout < r._timeout)
+ {
+ return true;
+ }
+ else if(r._timeout < _timeout)
+ {
+ return false;
+ }
}
if(getType() < r.getType())
{
- return true;
+ return true;
}
else if(r.getType() < getType())
{
- return false;
+ return false;
}
return false;
}
IceInternal::Reference::Reference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident,
- const Context& context, const string& fs, ReferenceMode md, bool sec) :
+ const Context& context, const string& fs, ReferenceMode md, bool sec) :
_hashInitialized(false),
_instance(inst),
_communicator(com),
@@ -474,18 +474,18 @@ IceInternal::Reference::applyOverrides(vector<EndpointPtr>& endpts) const
//
for(vector<EndpointPtr>::iterator p = endpts.begin(); p != endpts.end(); ++p)
{
- if(_overrideTimeout)
- {
- *p = (*p)->timeout(_timeout);
- }
+ if(_overrideTimeout)
+ {
+ *p = (*p)->timeout(_timeout);
+ }
}
}
IceUtil::Shared* IceInternal::upCast(IceInternal::FixedReference* p) { return p; }
IceInternal::FixedReference::FixedReference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident,
- const Context& context, const string& fs, ReferenceMode md,
- const vector<ConnectionPtr>& fixedConns) :
+ const Context& context, const string& fs, ReferenceMode md,
+ const vector<ConnectionPtr>& fixedConns) :
Reference(inst, com, ident, context, fs, md, false),
_fixedConnections(fixedConns)
{
@@ -594,9 +594,9 @@ IceInternal::FixedReference::getConnection() const
#ifndef ICEE_HAS_BATCH
case ReferenceModeBatchDatagram:
case ReferenceModeBatchOneway:
- {
- throw FeatureNotSupportedException(__FILE__, __LINE__, "batch proxy mode");
- }
+ {
+ throw FeatureNotSupportedException(__FILE__, __LINE__, "batch proxy mode");
+ }
#endif
}
@@ -619,28 +619,28 @@ IceInternal::FixedReference::getConnection() const
vector<ConnectionPtr> secureConnections;
while(p != connections.end())
{
- if((*p)->endpoint()->secure())
- {
- secureConnections.push_back(*p);
- p = connections.erase(p);
- }
- else
- {
- ++p;
- }
+ if((*p)->endpoint()->secure())
+ {
+ secureConnections.push_back(*p);
+ p = connections.erase(p);
+ }
+ else
+ {
+ ++p;
+ }
}
if(getSecure())
{
- connections.swap(secureConnections);
+ connections.swap(secureConnections);
}
else
{
- connections.insert(connections.end(), secureConnections.begin(), secureConnections.end());
+ connections.insert(connections.end(), secureConnections.begin(), secureConnections.end());
}
if(connections.empty())
{
- throw NoEndpointException(__FILE__, __LINE__); // No stringified representation for fixed proxies.
+ throw NoEndpointException(__FILE__, __LINE__); // No stringified representation for fixed proxies.
}
ConnectionPtr connection = connections[0];
@@ -680,7 +680,7 @@ IceInternal::FixedReference::operator<(const Reference& r) const
{
const FixedReference* rhs = dynamic_cast<const FixedReference*>(&r);
assert(rhs);
- return _fixedConnections < rhs->_fixedConnections;
+ return _fixedConnections < rhs->_fixedConnections;
}
return false;
}
@@ -706,10 +706,10 @@ IceInternal::RoutableReference::getRoutedEndpoints() const
if(_routerInfo)
{
//
- // If we route, we send everything to the router's client
- // proxy endpoints.
- //
- return _routerInfo->getClientEndpoints();
+ // If we route, we send everything to the router's client
+ // proxy endpoints.
+ //
+ return _routerInfo->getClientEndpoints();
}
return vector<EndpointPtr>();
}
@@ -720,7 +720,7 @@ IceInternal::RoutableReference::changeRouter(const RouterPrx& newRouter) const
RouterInfoPtr newRouterInfo = getInstance()->routerManager()->get(newRouter);
if(newRouterInfo == _routerInfo)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_routerInfo = newRouterInfo;
@@ -763,14 +763,14 @@ IceInternal::RoutableReference::operator<(const Reference& r) const
{
const RoutableReference* rhs = dynamic_cast<const RoutableReference*>(&r);
assert(rhs);
- return _routerInfo < rhs->_routerInfo;
+ return _routerInfo < rhs->_routerInfo;
}
return false;
}
IceInternal::RoutableReference::RoutableReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs,
- ReferenceMode md, bool sec, const RouterInfoPtr& rtrInfo) :
+ const Identity& ident, const Context& context, const string& fs,
+ ReferenceMode md, bool sec, const RouterInfoPtr& rtrInfo) :
Reference(inst, com, ident, context, fs, md, sec), _routerInfo(rtrInfo)
{
}
@@ -786,9 +786,9 @@ IceUtil::Shared* IceInternal::upCast(IceInternal::DirectReference* p) { return p
#ifdef ICEE_HAS_ROUTER
IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs, ReferenceMode md,
- bool sec, const vector<EndpointPtr>& endpts,
- const RouterInfoPtr& rtrInfo) :
+ const Identity& ident, const Context& context, const string& fs, ReferenceMode md,
+ bool sec, const vector<EndpointPtr>& endpts,
+ const RouterInfoPtr& rtrInfo) :
RoutableReference(inst, com, ident, context, fs, md, sec, rtrInfo),
_endpoints(endpts)
@@ -796,8 +796,8 @@ IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const Com
}
#else
IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs, ReferenceMode md,
- bool sec, const vector<EndpointPtr>& endpts) :
+ const Identity& ident, const Context& context, const string& fs, ReferenceMode md,
+ bool sec, const vector<EndpointPtr>& endpts) :
Reference(inst, com, ident, context, fs, md, sec),
_endpoints(endpts)
{
@@ -834,7 +834,7 @@ DirectReference::changeAdapterId(const string& newAdapterId) const
return getInstance()->referenceFactory()->create(getIdentity(), *getContext(), getFacet(), getMode(),
getSecure(), newAdapterId,
#ifdef ICEE_HAS_ROUTER
- getRouterInfo(),
+ getRouterInfo(),
#endif
locatorInfo);
}
@@ -858,12 +858,12 @@ IceInternal::DirectReference::changeTimeout(int newTimeout) const
DirectReferencePtr r = DirectReferencePtr::dynamicCast(Parent::changeTimeout(newTimeout));
if(r.get() != this) // Also override the timeout on the endpoints if it was updated.
{
- vector<EndpointPtr> newEndpoints;
- for(vector<EndpointPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
- {
- newEndpoints.push_back((*p)->timeout(newTimeout));
- }
- r->_endpoints = newEndpoints;
+ vector<EndpointPtr> newEndpoints;
+ for(vector<EndpointPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
+ {
+ newEndpoints.push_back((*p)->timeout(newTimeout));
+ }
+ r->_endpoints = newEndpoints;
}
return r;
}
@@ -877,14 +877,14 @@ IceInternal::DirectReference::streamWrite(BasicStream* s) const
s->writeSize(sz);
if(sz)
{
- for(vector<EndpointPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
- {
- (*p)->streamWrite(s);
- }
+ for(vector<EndpointPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
+ {
+ (*p)->streamWrite(s);
+ }
}
else
{
- s->write(string("")); // Adapter id.
+ s->write(string("")); // Adapter id.
}
}
@@ -896,12 +896,12 @@ IceInternal::DirectReference::toString() const
vector<EndpointPtr>::const_iterator p;
for(p = _endpoints.begin(); p != _endpoints.end(); ++p)
{
- string endp = (*p)->toString();
- if(!endp.empty())
- {
- result.append(":");
- result.append(endp);
- }
+ string endp = (*p)->toString();
+ if(!endp.empty())
+ {
+ result.append(":");
+ result.append(endp);
+ }
}
return result;
}
@@ -915,7 +915,7 @@ IceInternal::DirectReference::getConnection() const
if(endpts.empty())
{
- endpts = _endpoints; // Endpoint overrides are already applied on these endpoints.
+ endpts = _endpoints; // Endpoint overrides are already applied on these endpoints.
}
#else
vector<EndpointPtr> endpts = _endpoints;
@@ -975,8 +975,8 @@ IceInternal::DirectReference::operator<(const Reference& r) const
if(Parent::operator==(r))
{
const DirectReference* rhs = dynamic_cast<const DirectReference*>(&r);
- assert(rhs);
- return _endpoints < rhs->_endpoints;
+ assert(rhs);
+ return _endpoints < rhs->_endpoints;
}
return false;
}
@@ -998,9 +998,9 @@ IceUtil::Shared* IceInternal::upCast(IceInternal::IndirectReference* p) { return
#ifdef ICEE_HAS_ROUTER
IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs,
- ReferenceMode md, bool sec, const string& adptid,
- const RouterInfoPtr& rtrInfo, const LocatorInfoPtr& locInfo) :
+ const Identity& ident, const Context& context, const string& fs,
+ ReferenceMode md, bool sec, const string& adptid,
+ const RouterInfoPtr& rtrInfo, const LocatorInfoPtr& locInfo) :
RoutableReference(inst, com, ident, context, fs, md, sec, rtrInfo),
_adapterId(adptid),
_locatorInfo(locInfo)
@@ -1008,9 +1008,9 @@ IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const
}
#else
IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs,
- ReferenceMode md, bool sec, const string& adptid,
- const LocatorInfoPtr& locInfo) :
+ const Identity& ident, const Context& context, const string& fs,
+ ReferenceMode md, bool sec, const string& adptid,
+ const LocatorInfoPtr& locInfo) :
Reference(inst, com, ident, context, fs, md, sec),
_adapterId(adptid),
_locatorInfo(locInfo)
@@ -1054,7 +1054,7 @@ IceInternal::IndirectReference::changeLocator(const LocatorPrx& newLocator) cons
LocatorInfoPtr newLocatorInfo = getInstance()->locatorManager()->get(newLocator);
if(newLocatorInfo == _locatorInfo)
{
- return IndirectReferencePtr(const_cast<IndirectReference*>(this));
+ return IndirectReferencePtr(const_cast<IndirectReference*>(this));
}
IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_locatorInfo = newLocatorInfo;
@@ -1098,13 +1098,13 @@ IceInternal::IndirectReference::toString() const
a = IceUtil::escapeString(a, "");
if(a.find_first_of(" ") != string::npos)
{
- result.append("\"");
- result.append(a);
- result.append("\"");
+ result.append("\"");
+ result.append(a);
+ result.append("\"");
}
else
{
- result.append(_adapterId);
+ result.append(_adapterId);
}
return result;
}
@@ -1117,58 +1117,58 @@ IceInternal::IndirectReference::getConnection() const
while(true)
{
#ifdef ICEE_HAS_ROUTER
- vector<EndpointPtr> endpts = Parent::getRoutedEndpoints();
+ vector<EndpointPtr> endpts = Parent::getRoutedEndpoints();
#else
- vector<EndpointPtr> endpts;
+ vector<EndpointPtr> endpts;
#endif
- bool cached = false;
- if(endpts.empty() && _locatorInfo)
- {
- const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
- endpts = _locatorInfo->getEndpoints(self, cached);
- }
-
- applyOverrides(endpts);
-
- vector<EndpointPtr> filteredEndpoints = filterEndpoints(endpts, getMode(), getSecure());
- if(filteredEndpoints.empty())
- {
- throw NoEndpointException(__FILE__, __LINE__, toString());
- }
-
- try
- {
- OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory();
- connection = factory->create(filteredEndpoints);
- assert(connection);
- }
- catch(const LocalException& ex)
- {
+ bool cached = false;
+ if(endpts.empty() && _locatorInfo)
+ {
+ const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
+ endpts = _locatorInfo->getEndpoints(self, cached);
+ }
+
+ applyOverrides(endpts);
+
+ vector<EndpointPtr> filteredEndpoints = filterEndpoints(endpts, getMode(), getSecure());
+ if(filteredEndpoints.empty())
+ {
+ throw NoEndpointException(__FILE__, __LINE__, toString());
+ }
+
+ try
+ {
+ OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory();
+ connection = factory->create(filteredEndpoints);
+ assert(connection);
+ }
+ catch(const LocalException& ex)
+ {
#ifdef ICEE_HAS_ROUTER
- if(!getRouterInfo())
+ if(!getRouterInfo())
#endif
- {
- assert(_locatorInfo);
- const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
- _locatorInfo->clearCache(self);
-
- if(cached)
- {
- TraceLevelsPtr traceLevels = getInstance()->traceLevels();
- if(traceLevels->retry >= 2)
- {
- Trace out(getInstance()->initializationData().logger, traceLevels->retryCat);
- out << "connection to cached endpoints failed\n"
- << "removing endpoints from cache and trying one more time\n" << ex.toString();
- }
- continue;
- }
- }
-
- throw;
- }
-
- break;
+ {
+ assert(_locatorInfo);
+ const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
+ _locatorInfo->clearCache(self);
+
+ if(cached)
+ {
+ TraceLevelsPtr traceLevels = getInstance()->traceLevels();
+ if(traceLevels->retry >= 2)
+ {
+ Trace out(getInstance()->initializationData().logger, traceLevels->retryCat);
+ out << "connection to cached endpoints failed\n"
+ << "removing endpoints from cache and trying one more time\n" << ex.toString();
+ }
+ continue;
+ }
+ }
+
+ throw;
+ }
+
+ break;
}
#if defined(ICEE_HAS_ROUTER) && !defined(ICEE_PURE_CLIENT)
@@ -1238,16 +1238,16 @@ IceInternal::IndirectReference::operator<(const Reference& r) const
if(Parent::operator==(r))
{
const IndirectReference* rhs = dynamic_cast<const IndirectReference*>(&r);
- assert(rhs);
- if(_adapterId < rhs->_adapterId)
- {
- return true;
- }
- else if(rhs->_adapterId < _adapterId)
- {
- return false;
- }
- return _locatorInfo < rhs->_locatorInfo;
+ assert(rhs);
+ if(_adapterId < rhs->_adapterId)
+ {
+ return true;
+ }
+ else if(rhs->_adapterId < _adapterId)
+ {
+ return false;
+ }
+ return _locatorInfo < rhs->_locatorInfo;
}
return false;
}
@@ -1305,18 +1305,18 @@ IceInternal::filterEndpoints(const vector<EndpointPtr>& allEndpoints, ReferenceM
//
// Filter out non-datagram endpoints.
//
- endpoints.erase(remove_if(endpoints.begin(), endpoints.end(),
- not1(Ice::constMemFun(&Endpoint::datagram))),
- endpoints.end());
+ endpoints.erase(remove_if(endpoints.begin(), endpoints.end(),
+ not1(Ice::constMemFun(&Endpoint::datagram))),
+ endpoints.end());
break;
}
#ifndef ICEE_HAS_BATCH
case ReferenceModeBatchDatagram:
case ReferenceModeBatchOneway:
- {
- throw FeatureNotSupportedException(__FILE__, __LINE__, "batch proxy mode");
- }
+ {
+ throw FeatureNotSupportedException(__FILE__, __LINE__, "batch proxy mode");
+ }
#endif
}
@@ -1339,23 +1339,23 @@ IceInternal::filterEndpoints(const vector<EndpointPtr>& allEndpoints, ReferenceM
vector<EndpointPtr> secureEndpoints;
while(p != endpoints.end())
{
- if((*p)->secure())
- {
- secureEndpoints.push_back(*p);
- p = endpoints.erase(p);
- }
- else
- {
- ++p;
- }
+ if((*p)->secure())
+ {
+ secureEndpoints.push_back(*p);
+ p = endpoints.erase(p);
+ }
+ else
+ {
+ ++p;
+ }
}
if(sec)
{
- endpoints.swap(secureEndpoints);
+ endpoints.swap(secureEndpoints);
}
else
{
- endpoints.insert(endpoints.end(), secureEndpoints.begin(), secureEndpoints.end());
+ endpoints.insert(endpoints.end(), secureEndpoints.begin(), secureEndpoints.end());
}
return endpoints;
diff --git a/cppe/src/IceE/Reference.h b/cppe/src/IceE/Reference.h
index 443799e6582..933c4ac4330 100644
--- a/cppe/src/IceE/Reference.h
+++ b/cppe/src/IceE/Reference.h
@@ -38,9 +38,9 @@ public:
enum Type
{
- TypeDirect,
- TypeIndirect,
- TypeFixed
+ TypeDirect,
+ TypeIndirect,
+ TypeFixed
};
//
@@ -49,12 +49,12 @@ public:
//
// enum Mode
// {
-// ModeTwoway,
-// ModeOneway,
-// ModeBatchOneway,
-// ModeDatagram,
-// ModeBatchDatagram,
-// ModeLast = ModeBatchDatagram
+// ModeTwoway,
+// ModeOneway,
+// ModeBatchOneway,
+// ModeDatagram,
+// ModeBatchDatagram,
+// ModeLast = ModeBatchDatagram
// };
ReferenceMode getMode() const { return _mode; }
@@ -122,7 +122,7 @@ public:
protected:
Reference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, bool);
+ const std::string&, ReferenceMode, bool);
Reference(const Reference&);
void applyOverrides(std::vector<EndpointPtr>&) const;
@@ -158,7 +158,7 @@ class FixedReference : public Reference
public:
FixedReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, const std::vector<Ice::ConnectionPtr>&);
+ const std::string&, ReferenceMode, const std::vector<Ice::ConnectionPtr>&);
virtual Type getType() const;
virtual std::vector<EndpointPtr> getEndpoints() const;
@@ -214,7 +214,7 @@ public:
protected:
RoutableReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, bool, const RouterInfoPtr&);
+ const std::string&, ReferenceMode, bool, const RouterInfoPtr&);
RoutableReference(const RoutableReference&);
@@ -234,11 +234,11 @@ class DirectReference :
public:
DirectReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, bool, const std::vector<EndpointPtr>&
+ const std::string&, ReferenceMode, bool, const std::vector<EndpointPtr>&
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr&
+ , const RouterInfoPtr&
#endif
- );
+ );
virtual Type getType() const;
virtual std::vector<EndpointPtr> getEndpoints() const;
@@ -286,11 +286,11 @@ class IndirectReference :
public:
IndirectReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, bool, const std::string&
+ const std::string&, ReferenceMode, bool, const std::string&
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr&
+ , const RouterInfoPtr&
#endif
- , const LocatorInfoPtr&);
+ , const LocatorInfoPtr&);
virtual LocatorInfoPtr getLocatorInfo() const { return _locatorInfo; }
diff --git a/cppe/src/IceE/ReferenceFactory.cpp b/cppe/src/IceE/ReferenceFactory.cpp
index 9667390915a..1820be6c1a1 100644
--- a/cppe/src/IceE/ReferenceFactory.cpp
+++ b/cppe/src/IceE/ReferenceFactory.cpp
@@ -39,7 +39,7 @@ IceInternal::ReferenceFactory::copy(const Reference* r) const
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
const Ice::Identity& ident = r->getIdentity();
@@ -53,21 +53,21 @@ IceInternal::ReferenceFactory::copy(const Reference* r) const
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const Context& context,
- const string& facet,
- ReferenceMode mode,
- bool secure,
- const vector<EndpointPtr>& endpoints
+ const Context& context,
+ const string& facet,
+ ReferenceMode mode,
+ bool secure,
+ const vector<EndpointPtr>& endpoints
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr& routerInfo
+ , const RouterInfoPtr& routerInfo
#endif
- )
+ )
{
Mutex::Lock sync(*this);
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -89,21 +89,21 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const Context& context,
- const string& facet,
- ReferenceMode mode,
- bool secure,
- const string& adapterId
+ const Context& context,
+ const string& facet,
+ ReferenceMode mode,
+ bool secure,
+ const string& adapterId
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr& routerInfo
+ , const RouterInfoPtr& routerInfo
#endif
- , const LocatorInfoPtr& locatorInfo)
+ , const LocatorInfoPtr& locatorInfo)
{
Mutex::Lock sync(*this);
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -116,7 +116,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
//
#ifdef ICEE_HAS_ROUTER
return new IndirectReference(_instance, _communicator, ident, context, facet, mode, secure, adapterId, routerInfo,
- locatorInfo);
+ locatorInfo);
#else
return new IndirectReference(_instance, _communicator, ident, context, facet, mode, secure, adapterId, locatorInfo);
#endif
@@ -126,16 +126,16 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const Context& context,
- const string& facet,
- ReferenceMode mode,
- const vector<Ice::ConnectionPtr>& fixedConnections)
+ const Context& context,
+ const string& facet,
+ ReferenceMode mode,
+ const vector<Ice::ConnectionPtr>& fixedConnections)
{
Mutex::Lock sync(*this);
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -166,7 +166,7 @@ IceInternal::ReferenceFactory::create(const string& str)
beg = s.find_first_not_of(delim, end);
if(beg == string::npos)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
//
@@ -177,7 +177,7 @@ IceInternal::ReferenceFactory::create(const string& str)
end = IceUtil::checkQuote(s, beg);
if(end == string::npos)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
else if(end == 0)
{
@@ -197,7 +197,7 @@ IceInternal::ReferenceFactory::create(const string& str)
if(beg == end)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
//
@@ -238,50 +238,50 @@ IceInternal::ReferenceFactory::create(const string& str)
while(true)
{
- beg = s.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
+ beg = s.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
if(s[beg] == ':' || s[beg] == '@')
{
break;
}
- end = s.find_first_of(delim + ":@", beg);
- if(end == string::npos)
- {
- end = s.length();
- }
-
- if(beg == end)
- {
- break;
- }
-
- string option = s.substr(beg, end - beg);
- if(option.length() != 2 || option[0] != '-')
- {
+ end = s.find_first_of(delim + ":@", beg);
+ if(end == string::npos)
+ {
+ end = s.length();
+ }
+
+ if(beg == end)
+ {
+ break;
+ }
+
+ string option = s.substr(beg, end - beg);
+ if(option.length() != 2 || option[0] != '-')
+ {
throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ }
//
// Check for the presence of an option argument. The
// argument may be enclosed in single or double
// quotation marks.
//
- string argument;
- string::size_type argumentBeg = s.find_first_not_of(delim, end);
- if(argumentBeg != string::npos)
- {
+ string argument;
+ string::size_type argumentBeg = s.find_first_not_of(delim, end);
+ if(argumentBeg != string::npos)
+ {
if(s[argumentBeg] != '@' && s[argumentBeg] != ':' && s[argumentBeg] != '-')
{
beg = argumentBeg;
end = IceUtil::checkQuote(s, beg);
if(end == string::npos)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
else if(end == 0)
{
@@ -298,26 +298,26 @@ IceInternal::ReferenceFactory::create(const string& str)
argument = s.substr(beg, end - beg);
end++; // Skip trailing quote
}
- }
- }
-
- //
- // If any new options are added here,
- // IceInternal::Reference::toString() and its derived classes must be updated as well.
- //
- switch(option[1])
- {
- case 'f':
- {
- if(argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
-
- if(!IceUtil::unescapeString(argument, 0, argument.size(), facet))
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ }
+ }
+
+ //
+ // If any new options are added here,
+ // IceInternal::Reference::toString() and its derived classes must be updated as well.
+ //
+ switch(option[1])
+ {
+ case 'f':
+ {
+ if(argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+
+ if(!IceUtil::unescapeString(argument, 0, argument.size(), facet))
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
#ifdef ICEE_HAS_WSTRING
if(_instance->initializationData().stringConverter)
{
@@ -328,74 +328,74 @@ IceInternal::ReferenceFactory::create(const string& str)
facet = tmpFacet;
}
#endif
- break;
- }
-
- case 't':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeTwoway;
- break;
- }
-
- case 'o':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeOneway;
- break;
- }
-
- case 'O':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeBatchOneway;
- break;
- }
-
- case 'd':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeDatagram;
- break;
- }
-
- case 'D':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeBatchDatagram;
- break;
- }
-
- case 's':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- secure = true;
- break;
- }
-
- default:
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- }
+ break;
+ }
+
+ case 't':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeTwoway;
+ break;
+ }
+
+ case 'o':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeOneway;
+ break;
+ }
+
+ case 'O':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeBatchOneway;
+ break;
+ }
+
+ case 'd':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeDatagram;
+ break;
+ }
+
+ case 'D':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeBatchDatagram;
+ break;
+ }
+
+ case 's':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ secure = true;
+ break;
+ }
+
+ default:
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ }
}
#ifdef ICEE_HAS_ROUTER
@@ -409,111 +409,111 @@ IceInternal::ReferenceFactory::create(const string& str)
{
#ifdef ICEE_HAS_LOCATOR
# ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, "", routerInfo, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, "", routerInfo, locatorInfo);
# else
- return create(ident, Ice::Context(), facet, mode, secure, "", locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, "", locatorInfo);
# endif
-#else
+#else
throw FeatureNotSupportedException(__FILE__, __LINE__,
- "indirect proxy `" + str + "' (no locator support built-in)");
+ "indirect proxy `" + str + "' (no locator support built-in)");
#endif
}
vector<EndpointPtr> endpoints;
switch(s[beg])
{
- case ':':
- {
- vector<string> unknownEndpoints;
- end = beg;
-
- while(end < s.length() && s[end] == ':')
- {
- beg = end + 1;
-
- end = s.find(':', beg);
- if(end == string::npos)
- {
- end = s.length();
- }
-
- string es = s.substr(beg, end - beg);
- EndpointPtr endp = _instance->endpointFactory()->create(es);
- if(endp != 0)
- {
- vector<EndpointPtr> endps = endp->expand(false);
- endpoints.insert(endpoints.end(), endps.begin(), endps.end());
- }
- else
- {
- unknownEndpoints.push_back(es);
- }
- }
- if(endpoints.size() == 0)
- {
- throw EndpointParseException(__FILE__, __LINE__, unknownEndpoints.front());
- }
- else if(unknownEndpoints.size() != 0 &&
- _instance->initializationData().properties->getPropertyAsIntWithDefault(
- "Ice.Warn.Endpoints", 1) > 0)
- {
- Warning out(_instance->initializationData().logger);
- out << "Proxy contains unknown endpoints:";
- for(unsigned int idx = 0; idx < unknownEndpoints.size(); ++idx)
- {
- out << " `" << unknownEndpoints[idx] << "'";
- }
- }
+ case ':':
+ {
+ vector<string> unknownEndpoints;
+ end = beg;
+
+ while(end < s.length() && s[end] == ':')
+ {
+ beg = end + 1;
+
+ end = s.find(':', beg);
+ if(end == string::npos)
+ {
+ end = s.length();
+ }
+
+ string es = s.substr(beg, end - beg);
+ EndpointPtr endp = _instance->endpointFactory()->create(es);
+ if(endp != 0)
+ {
+ vector<EndpointPtr> endps = endp->expand(false);
+ endpoints.insert(endpoints.end(), endps.begin(), endps.end());
+ }
+ else
+ {
+ unknownEndpoints.push_back(es);
+ }
+ }
+ if(endpoints.size() == 0)
+ {
+ throw EndpointParseException(__FILE__, __LINE__, unknownEndpoints.front());
+ }
+ else if(unknownEndpoints.size() != 0 &&
+ _instance->initializationData().properties->getPropertyAsIntWithDefault(
+ "Ice.Warn.Endpoints", 1) > 0)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "Proxy contains unknown endpoints:";
+ for(unsigned int idx = 0; idx < unknownEndpoints.size(); ++idx)
+ {
+ out << " `" << unknownEndpoints[idx] << "'";
+ }
+ }
#ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, endpoints, routerInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, endpoints, routerInfo);
#else
- return create(ident, Ice::Context(), facet, mode, secure, endpoints);
+ return create(ident, Ice::Context(), facet, mode, secure, endpoints);
#endif
- break;
- }
+ break;
+ }
- case '@':
- {
+ case '@':
+ {
#ifdef ICEE_HAS_LOCATOR
- beg = s.find_first_not_of(delim, beg + 1);
- if(beg == string::npos)
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ beg = s.find_first_not_of(delim, beg + 1);
+ if(beg == string::npos)
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
string adapterstr;
- end = IceUtil::checkQuote(s, beg);
- if(end == string::npos)
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- else if(end == 0)
- {
- end = s.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = s.size();
- }
+ end = IceUtil::checkQuote(s, beg);
+ if(end == string::npos)
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ else if(end == 0)
+ {
+ end = s.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = s.size();
+ }
adapterstr = s.substr(beg, end - beg);
- }
- else
- {
- beg++; // Skip leading quote
+ }
+ else
+ {
+ beg++; // Skip leading quote
adapterstr = s.substr(beg, end - beg);
end++; // Skip trailing quote.
- }
+ }
// Check for trailing whitespace.
if(end != string::npos && s.find_first_not_of(delim, end) != string::npos)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
- if(!IceUtil::unescapeString(adapterstr, 0, adapterstr.size(), adapter) || adapter.size() == 0)
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ if(!IceUtil::unescapeString(adapterstr, 0, adapterstr.size(), adapter) || adapter.size() == 0)
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
#ifdef ICEE_HAS_WSTRING
if(_instance->initializationData().stringConverter)
{
@@ -526,21 +526,21 @@ IceInternal::ReferenceFactory::create(const string& str)
#endif
#ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, adapter, routerInfo, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, adapter, routerInfo, locatorInfo);
#else
- return create(ident, Ice::Context(), facet, mode, secure, adapter, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, adapter, locatorInfo);
#endif
#else
throw FeatureNotSupportedException(__FILE__, __LINE__,
- "indirect proxy `" + str + "' (no locator support built-in)");
+ "indirect proxy `" + str + "' (no locator support built-in)");
#endif
- break;
- }
+ break;
+ }
- default:
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ default:
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
}
return 0; // Unreachable, fixes compiler warning.
@@ -603,7 +603,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
if(ident.name.empty() && ident.category.empty())
{
- return 0;
+ return 0;
}
//
@@ -614,11 +614,11 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
string facet;
if(!facetPath.empty())
{
- if(facetPath.size() > 1)
- {
- throwProxyUnmarshalException(__FILE__, __LINE__);
- }
- facet.swap(facetPath[0]);
+ if(facetPath.size() > 1)
+ {
+ throwProxyUnmarshalException(__FILE__, __LINE__);
+ }
+ facet.swap(facetPath[0]);
}
Byte modeAsByte;
@@ -626,7 +626,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
ReferenceMode mode = static_cast<ReferenceMode>(modeAsByte);
if(mode < 0 || mode > ReferenceModeLast)
{
- throwProxyUnmarshalException(__FILE__, __LINE__);
+ throwProxyUnmarshalException(__FILE__, __LINE__);
}
vector<EndpointPtr> endpoints;
@@ -644,30 +644,30 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
if(sz > 0)
{
- endpoints.reserve(sz);
- while(sz--)
- {
- EndpointPtr endpoint = _instance->endpointFactory()->read(s);
- endpoints.push_back(endpoint);
- }
+ endpoints.reserve(sz);
+ while(sz--)
+ {
+ EndpointPtr endpoint = _instance->endpointFactory()->read(s);
+ endpoints.push_back(endpoint);
+ }
#ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, endpoints, routerInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, endpoints, routerInfo);
#else
- return create(ident, Ice::Context(), facet, mode, secure, endpoints);
+ return create(ident, Ice::Context(), facet, mode, secure, endpoints);
#endif
}
else
{
#ifdef ICEE_HAS_LOCATOR
- LocatorInfoPtr locatorInfo = _instance->locatorManager()->get(getDefaultLocator());
- s->read(adapterId);
+ LocatorInfoPtr locatorInfo = _instance->locatorManager()->get(getDefaultLocator());
+ s->read(adapterId);
# ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, adapterId, routerInfo, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, adapterId, routerInfo, locatorInfo);
# else
- return create(ident, Ice::Context(), facet, mode, secure, adapterId, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, adapterId, locatorInfo);
# endif
#else
- throwProxyUnmarshalException(__FILE__, __LINE__);
+ throwProxyUnmarshalException(__FILE__, __LINE__);
return 0; // Unreachable, fixes compiler warning.
#endif
}
@@ -710,7 +710,7 @@ IceInternal::ReferenceFactory::getDefaultLocator() const
#endif
IceInternal::ReferenceFactory::ReferenceFactory(const InstancePtr& instance,
- const CommunicatorPtr& communicator) :
+ const CommunicatorPtr& communicator) :
_instance(instance),
_communicator(communicator)
{
@@ -723,7 +723,7 @@ IceInternal::ReferenceFactory::destroy()
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
_instance = 0;
diff --git a/cppe/src/IceE/ReferenceFactory.h b/cppe/src/IceE/ReferenceFactory.h
index 4127e453deb..d3f1ce82b3d 100644
--- a/cppe/src/IceE/ReferenceFactory.h
+++ b/cppe/src/IceE/ReferenceFactory.h
@@ -34,19 +34,19 @@ public:
ReferencePtr create(const ::Ice::Identity&, const Ice::Context&, const ::std::string&, ReferenceMode, bool,
const ::std::vector<EndpointPtr>&
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr&
+ , const RouterInfoPtr&
#endif
- );
+ );
//
// Create an indirect reference.
//
#ifdef ICEE_HAS_LOCATOR
ReferencePtr create(const ::Ice::Identity&, const Ice::Context&, const ::std::string&, ReferenceMode, bool,
- const ::std::string&
+ const ::std::string&
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr&
+ , const RouterInfoPtr&
#endif
- , const LocatorInfoPtr&);
+ , const LocatorInfoPtr&);
#endif
//
// Create a fixed reference.
diff --git a/cppe/src/IceE/RouterInfo.cpp b/cppe/src/IceE/RouterInfo.cpp
index 508c93387e6..c96d1ff2acb 100644
--- a/cppe/src/IceE/RouterInfo.cpp
+++ b/cppe/src/IceE/RouterInfo.cpp
@@ -46,7 +46,7 @@ IceInternal::RouterManager::get(const RouterPrx& rtr)
{
if(!rtr)
{
- return 0;
+ return 0;
}
RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
@@ -57,24 +57,24 @@ IceInternal::RouterManager::get(const RouterPrx& rtr)
if(_tableHint != _table.end())
{
- if(_tableHint->first == router)
- {
- p = _tableHint;
- }
+ if(_tableHint->first == router)
+ {
+ p = _tableHint;
+ }
}
if(p == _table.end())
{
- p = _table.find(router);
+ p = _table.find(router);
}
if(p == _table.end())
{
- _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router)));
+ _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router)));
}
else
{
- _tableHint = p;
+ _tableHint = p;
}
return _tableHint->second;
@@ -86,26 +86,26 @@ IceInternal::RouterManager::erase(const RouterPrx& rtr)
RouterInfoPtr info;
if(rtr)
{
- RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
- IceUtil::Mutex::Lock sync(*this);
-
- map<RouterPrx, RouterInfoPtr>::iterator p = _table.end();
- if(_tableHint != _table.end() && _tableHint->first == router)
- {
- p = _tableHint;
- _tableHint = _table.end();
- }
-
- if(p == _table.end())
- {
- p = _table.find(router);
- }
-
- if(p != _table.end())
- {
- info = p->second;
- _table.erase(p);
- }
+ RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
+ IceUtil::Mutex::Lock sync(*this);
+
+ map<RouterPrx, RouterInfoPtr>::iterator p = _table.end();
+ if(_tableHint != _table.end() && _tableHint->first == router)
+ {
+ p = _tableHint;
+ _tableHint = _table.end();
+ }
+
+ if(p == _table.end())
+ {
+ p = _table.find(router);
+ }
+
+ if(p != _table.end())
+ {
+ info = p->second;
+ _table.erase(p);
+ }
}
return info;
@@ -164,24 +164,24 @@ IceInternal::RouterInfo::getClientEndpoints()
if(_clientEndpoints.size() == 0) // Lazy initialization.
{
- ObjectPrx clientProxy = _router->getClientProxy();
- if(!clientProxy)
- {
+ ObjectPrx clientProxy = _router->getClientProxy();
+ if(!clientProxy)
+ {
//
// If getClientProxy() return nil, use router endpoints.
//
_clientEndpoints = _router->__reference()->getEndpoints();
- }
+ }
else
{
- clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed.
+ clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed.
- //
- // In order to avoid creating a new connection to the router,
- // we must use the same timeout as the already existing
- // connection.
- //
- clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout());
+ //
+ // In order to avoid creating a new connection to the router,
+ // we must use the same timeout as the already existing
+ // connection.
+ //
+ clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout());
_clientEndpoints = clientProxy->__reference()->getEndpoints();
}
@@ -197,13 +197,13 @@ IceInternal::RouterInfo::getServerEndpoints()
if(_serverEndpoints.size() == 0) // Lazy initialization.
{
- ObjectPrx serverProxy = _router->getServerProxy();
- if(!serverProxy)
- {
- throw NoEndpointException(__FILE__, __LINE__);
- }
+ ObjectPrx serverProxy = _router->getServerProxy();
+ if(!serverProxy)
+ {
+ throw NoEndpointException(__FILE__, __LINE__);
+ }
- serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed.
+ serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed.
_serverEndpoints = serverProxy->__reference()->getEndpoints();
}
diff --git a/cppe/src/IceE/ServantManager.cpp b/cppe/src/IceE/ServantManager.cpp
index 98a233cc77e..4eacee31ea7 100644
--- a/cppe/src/IceE/ServantManager.cpp
+++ b/cppe/src/IceE/ServantManager.cpp
@@ -29,26 +29,26 @@ IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity&
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end())
{
- p = _servantMapMap.insert(_servantMapMapHint, pair<const Identity, FacetMap>(ident, FacetMap()));
+ p = _servantMapMap.insert(_servantMapMapHint, pair<const Identity, FacetMap>(ident, FacetMap()));
}
else
{
- if(p->second.find(facet) != p->second.end())
- {
- AlreadyRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
- }
+ if(p->second.find(facet) != p->second.end())
+ {
+ AlreadyRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
+ }
}
_servantMapMapHint = p;
@@ -75,19 +75,19 @@ IceInternal::ServantManager::removeServant(const Identity& ident, const string&
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end() || (q = p->second.find(facet)) == p->second.end())
{
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
}
servant = q->second;
@@ -95,15 +95,15 @@ IceInternal::ServantManager::removeServant(const Identity& ident, const string&
if(p->second.empty())
{
- if(p == _servantMapMapHint)
- {
- _servantMapMap.erase(p++);
- _servantMapMapHint = p;
- }
- else
- {
- _servantMapMap.erase(p);
- }
+ if(p == _servantMapMapHint)
+ {
+ _servantMapMap.erase(p++);
+ _servantMapMapHint = p;
+ }
+ else
+ {
+ _servantMapMap.erase(p);
+ }
}
return servant;
}
@@ -119,27 +119,27 @@ IceInternal::ServantManager::removeAllFacets(const Identity& ident)
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end())
{
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ throw ex;
}
FacetMap result = p->second;
if(p == _servantMapMapHint)
{
- _servantMapMap.erase(p++);
- _servantMapMapHint = p;
+ _servantMapMap.erase(p++);
+ _servantMapMapHint = p;
}
else
{
- _servantMapMap.erase(p);
+ _servantMapMap.erase(p);
}
return result;
@@ -155,7 +155,7 @@ IceInternal::ServantManager::findServant(const Identity& ident, const string& fa
// requests from bidir connections. This method might be called if
// requests are received over the bidir connection after the
// adapter was deactivated.
- //
+ //
//assert(_instance); // Must not be called after destruction.
ServantMapMap::iterator p = _servantMapMapHint;
@@ -165,17 +165,17 @@ IceInternal::ServantManager::findServant(const Identity& ident, const string& fa
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end() || (q = p->second.find(facet)) == p->second.end())
{
- return 0;
+ return 0;
}
else
{
- _servantMapMapHint = p;
- return q->second;
+ _servantMapMapHint = p;
+ return q->second;
}
}
@@ -192,17 +192,17 @@ IceInternal::ServantManager::findAllFacets(const Identity& ident) const
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end())
{
- return FacetMap();
+ return FacetMap();
}
else
{
- _servantMapMapHint = p;
- return p->second;
+ _servantMapMapHint = p;
+ return p->second;
}
}
@@ -216,7 +216,7 @@ IceInternal::ServantManager::hasServant(const Identity& ident) const
// requests from bidir connections. This method might be called if
// requests are received over the bidir connection after the
// adapter was deactivated.
- //
+ //
//assert(_instance); // Must not be called after destruction.
ServantMapMap::iterator p = _servantMapMapHint;
@@ -224,18 +224,18 @@ IceInternal::ServantManager::hasServant(const Identity& ident) const
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end())
{
- return false;
+ return false;
}
else
{
- _servantMapMapHint = p;
- assert(!p->second.empty());
- return true;
+ _servantMapMapHint = p;
+ assert(!p->second.empty());
+ return true;
}
}
@@ -262,14 +262,14 @@ IceInternal::ServantManager::destroy()
ServantMapMap servantMapMap;
{
- IceUtil::Mutex::Lock sync(*this);
-
- assert(_instance); // Must not be called after destruction.
-
- servantMapMap.swap(_servantMapMap);
- _servantMapMapHint = _servantMapMap.end();
-
- _instance = 0;
+ IceUtil::Mutex::Lock sync(*this);
+
+ assert(_instance); // Must not be called after destruction.
+
+ servantMapMap.swap(_servantMapMap);
+ _servantMapMapHint = _servantMapMap.end();
+
+ _instance = 0;
}
//
diff --git a/cppe/src/IceE/StaticMutex.cpp b/cppe/src/IceE/StaticMutex.cpp
index 6e51c9b132a..26ea365d03b 100644
--- a/cppe/src/IceE/StaticMutex.cpp
+++ b/cppe/src/IceE/StaticMutex.cpp
@@ -17,7 +17,7 @@ void IceUtil::StaticMutex::initialize() const
//
CRITICAL_SECTION* newCriticalSection = new CRITICAL_SECTION;
InitializeCriticalSection(newCriticalSection);
-
+
//
// Then assign it to _mutex
// Note that Windows performs a full memory barrier before the assignment;
@@ -25,11 +25,11 @@ void IceUtil::StaticMutex::initialize() const
//
if(InterlockedCompareExchangePointer(reinterpret_cast<void**>(&_mutex), newCriticalSection, 0) != 0)
{
- //
- // Another thread was doing the same thing
- //
- DeleteCriticalSection(newCriticalSection);
- delete newCriticalSection;
+ //
+ // Another thread was doing the same thing
+ //
+ DeleteCriticalSection(newCriticalSection);
+ delete newCriticalSection;
}
//
diff --git a/cppe/src/IceE/StringConverter.cpp b/cppe/src/IceE/StringConverter.cpp
index 837773b8e03..adf1c6d319a 100644
--- a/cppe/src/IceE/StringConverter.cpp
+++ b/cppe/src/IceE/StringConverter.cpp
@@ -23,8 +23,8 @@ namespace Ice
Byte*
UnicodeWstringConverter::toUTF8(const wchar_t* sourceStart,
- const wchar_t* sourceEnd,
- UTF8Buffer& buffer) const
+ const wchar_t* sourceEnd,
+ UTF8Buffer& buffer) const
{
//
// The "chunk size" is the maximum of the number of characters in the
@@ -38,51 +38,51 @@ UnicodeWstringConverter::toUTF8(const wchar_t* sourceStart,
ConversionResult result;
while((result =
- convertUTFWstringToUTF8(sourceStart, sourceEnd,
- targetStart, targetEnd, lenientConversion))
- == targetExhausted)
+ convertUTFWstringToUTF8(sourceStart, sourceEnd,
+ targetStart, targetEnd, lenientConversion))
+ == targetExhausted)
{
- targetStart = buffer.getMoreBytes(chunkSize, targetStart);
- targetEnd = targetStart + chunkSize;
+ targetStart = buffer.getMoreBytes(chunkSize, targetStart);
+ targetEnd = targetStart + chunkSize;
}
-
+
switch(result)
{
- case conversionOK:
- break;
- case sourceExhausted:
- throw StringConversionException(__FILE__, __LINE__, "wide string source exhausted");
- case sourceIllegal:
- throw StringConversionException(__FILE__, __LINE__, "wide string source illegal");
- default:
- {
- assert(0);
- throw StringConversionException(__FILE__, __LINE__);
- }
+ case conversionOK:
+ break;
+ case sourceExhausted:
+ throw StringConversionException(__FILE__, __LINE__, "wide string source exhausted");
+ case sourceIllegal:
+ throw StringConversionException(__FILE__, __LINE__, "wide string source illegal");
+ default:
+ {
+ assert(0);
+ throw StringConversionException(__FILE__, __LINE__);
+ }
}
return targetStart;
}
void
UnicodeWstringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
- wstring& target) const
+ wstring& target) const
{
ConversionResult result =
- convertUTF8ToUTFWstring(sourceStart, sourceEnd, target, lenientConversion);
+ convertUTF8ToUTFWstring(sourceStart, sourceEnd, target, lenientConversion);
switch(result)
- {
- case conversionOK:
- break;
- case sourceExhausted:
- throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
- case sourceIllegal:
- throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source illegal");
- default:
- {
- assert(0);
- throw StringConversionException(__FILE__, __LINE__);
- }
+ {
+ case conversionOK:
+ break;
+ case sourceExhausted:
+ throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
+ case sourceIllegal:
+ throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source illegal");
+ default:
+ {
+ assert(0);
+ throw StringConversionException(__FILE__, __LINE__);
+ }
}
}
diff --git a/cppe/src/IceE/StringUtil.cpp b/cppe/src/IceE/StringUtil.cpp
index c728e3151a2..7cce1177fd6 100644
--- a/cppe/src/IceE/StringUtil.cpp
+++ b/cppe/src/IceE/StringUtil.cpp
@@ -42,86 +42,86 @@ encodeChar(string::value_type b, string& s, const string& special)
{
switch(b)
{
- case '\\':
- {
- s.append("\\\\");
- break;
- }
-
- case '\'':
- {
- s.append("\\'");
- break;
- }
-
- case '"':
- {
- s.append("\\\"");
- break;
- }
-
- case '\b':
- {
- s.append("\\b");
- break;
- }
-
- case '\f':
- {
- s.append("\\f");
- break;
- }
-
- case '\n':
- {
- s.append("\\n");
- break;
- }
-
- case '\r':
- {
- s.append("\\r");
- break;
- }
-
- case '\t':
- {
- s.append("\\t");
- break;
- }
-
- default:
- {
- unsigned char i = static_cast<unsigned char>(b);
- if(!(i >= 32 && i <= 126))
- {
- s.push_back('\\');
- string octal = toOctalString(i);
- //
- // Add leading zeroes so that we avoid problems during
- // decoding. For example, consider the escaped string
- // \0013 (i.e., a character with value 1 followed by the
- // character '3'). If the leading zeroes were omitted, the
- // result would be incorrectly interpreted as a single
- // character with value 11.
- //
- for(string::size_type j = octal.size(); j < 3; j++)
- {
- s.push_back('0');
- }
- s.append(octal);
- }
- else if(special.find(b) != string::npos)
- {
- s.push_back('\\');
- s.push_back(b);
- }
- else
- {
- s.push_back(b);
- }
- break;
- }
+ case '\\':
+ {
+ s.append("\\\\");
+ break;
+ }
+
+ case '\'':
+ {
+ s.append("\\'");
+ break;
+ }
+
+ case '"':
+ {
+ s.append("\\\"");
+ break;
+ }
+
+ case '\b':
+ {
+ s.append("\\b");
+ break;
+ }
+
+ case '\f':
+ {
+ s.append("\\f");
+ break;
+ }
+
+ case '\n':
+ {
+ s.append("\\n");
+ break;
+ }
+
+ case '\r':
+ {
+ s.append("\\r");
+ break;
+ }
+
+ case '\t':
+ {
+ s.append("\\t");
+ break;
+ }
+
+ default:
+ {
+ unsigned char i = static_cast<unsigned char>(b);
+ if(!(i >= 32 && i <= 126))
+ {
+ s.push_back('\\');
+ string octal = toOctalString(i);
+ //
+ // Add leading zeroes so that we avoid problems during
+ // decoding. For example, consider the escaped string
+ // \0013 (i.e., a character with value 1 followed by the
+ // character '3'). If the leading zeroes were omitted, the
+ // result would be incorrectly interpreted as a single
+ // character with value 11.
+ //
+ for(string::size_type j = octal.size(); j < 3; j++)
+ {
+ s.push_back('0');
+ }
+ s.append(octal);
+ }
+ else if(special.find(b) != string::npos)
+ {
+ s.push_back('\\');
+ s.push_back(b);
+ }
+ else
+ {
+ s.push_back(b);
+ }
+ break;
+ }
}
}
@@ -136,16 +136,16 @@ IceUtil::escapeString(const string& s, const string& special)
string::size_type i;
for(i = 0; i < special.size(); ++i)
{
- if(static_cast<unsigned char>(special[i]) < 32 || static_cast<unsigned char>(special[i]) > 126)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "special characters must be in ASCII range 32-126");
- }
+ if(static_cast<unsigned char>(special[i]) < 32 || static_cast<unsigned char>(special[i]) > 126)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "special characters must be in ASCII range 32-126");
+ }
}
string result;
for(i = 0; i < s.size(); ++i)
{
- encodeChar(s[i], result, special);
+ encodeChar(s[i], result, special);
}
return result;
@@ -178,86 +178,86 @@ decodeChar(const string& s, string::size_type start, string::size_type end, stri
if(s[start] != '\\')
{
- c = checkChar(s[start++]);
+ c = checkChar(s[start++]);
}
else
{
- if(start + 1 == end)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "trailing backslash in argument");
- }
- switch(s[++start])
- {
- case '\\':
- case '\'':
- case '"':
- {
- c = s[start++];
- break;
- }
- case 'b':
- {
- ++start;
- c = '\b';
- break;
- }
- case 'f':
- {
- ++start;
- c = '\f';
- break;
- }
- case 'n':
- {
- ++start;
- c = '\n';
- break;
- }
- case 'r':
- {
- ++start;
- c = '\r';
- break;
- }
- case 't':
- {
- ++start;
- c = '\t';
- break;
- }
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int oct = 0;
- for(int j = 0; j < 3 && start < end; ++j)
- {
- int charVal = s[start++] - '0';
- if(charVal < 0 || charVal > 7)
- {
- --start;
- break;
- }
- oct = oct * 8 + charVal;
- }
- if(oct > 255)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "octal value out of range");
- }
- c = (char)oct;
- break;
- }
- default:
- {
- c = checkChar(s[start++]);
- break;
- }
- }
+ if(start + 1 == end)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "trailing backslash in argument");
+ }
+ switch(s[++start])
+ {
+ case '\\':
+ case '\'':
+ case '"':
+ {
+ c = s[start++];
+ break;
+ }
+ case 'b':
+ {
+ ++start;
+ c = '\b';
+ break;
+ }
+ case 'f':
+ {
+ ++start;
+ c = '\f';
+ break;
+ }
+ case 'n':
+ {
+ ++start;
+ c = '\n';
+ break;
+ }
+ case 'r':
+ {
+ ++start;
+ c = '\r';
+ break;
+ }
+ case 't':
+ {
+ ++start;
+ c = '\t';
+ break;
+ }
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int oct = 0;
+ for(int j = 0; j < 3 && start < end; ++j)
+ {
+ int charVal = s[start++] - '0';
+ if(charVal < 0 || charVal > 7)
+ {
+ --start;
+ break;
+ }
+ oct = oct * 8 + charVal;
+ }
+ if(oct > 255)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "octal value out of range");
+ }
+ c = (char)oct;
+ break;
+ }
+ default:
+ {
+ c = checkChar(s[start++]);
+ break;
+ }
+ }
}
nextStart = start;
return c;
@@ -271,7 +271,7 @@ static void decodeString(const string& s, string::size_type start, string::size_
{
while(start < end)
{
- sb.push_back(decodeChar(s, start, end, start));
+ sb.push_back(decodeChar(s, start, end, start));
}
}
@@ -291,20 +291,20 @@ IceUtil::unescapeString(const string& s, string::size_type start, string::size_t
}
if(start > end)
{
- throw IllegalArgumentException(__FILE__, __LINE__, "start offset must <= end offset");
+ throw IllegalArgumentException(__FILE__, __LINE__, "start offset must <= end offset");
}
result.reserve(end - start);
try
{
- result.clear();
- decodeString(s, start, end, result);
- return true;
+ result.clear();
+ decodeString(s, start, end, result);
+ return true;
}
catch(...)
{
- return false;
+ return false;
}
}
@@ -373,29 +373,29 @@ IceUtil::match(const string& s, const string& pat, bool matchPeriod)
do
{
if(pat[patIndex] == '*')
- {
- //
- // Don't allow matching x..y against x.*.y if requested -- star matches non-empty sequence only.
- //
- if(!matchPeriod && s[sIndex] == '.')
- {
- return false;
- }
- while(sIndex < s.size() && (matchPeriod || s[sIndex] != '.'))
- {
- ++sIndex;
- }
- patIndex++;
- }
- else
- {
- if(pat[patIndex] != s[sIndex])
- {
- return false;
- }
- ++sIndex;
- ++patIndex;
- }
+ {
+ //
+ // Don't allow matching x..y against x.*.y if requested -- star matches non-empty sequence only.
+ //
+ if(!matchPeriod && s[sIndex] == '.')
+ {
+ return false;
+ }
+ while(sIndex < s.size() && (matchPeriod || s[sIndex] != '.'))
+ {
+ ++sIndex;
+ }
+ patIndex++;
+ }
+ else
+ {
+ if(pat[patIndex] != s[sIndex])
+ {
+ return false;
+ }
+ ++sIndex;
+ ++patIndex;
+ }
}
while(sIndex < s.size() && patIndex < pat.size());
diff --git a/cppe/src/IceE/Thread.cpp b/cppe/src/IceE/Thread.cpp
index 1b195cd44b7..c3ca404c47b 100644
--- a/cppe/src/IceE/Thread.cpp
+++ b/cppe/src/IceE/Thread.cpp
@@ -44,13 +44,13 @@ IceUtil::ThreadControl::join()
{
if(_handle == 0)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
int rc = WaitForSingleObject(_handle, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
detach();
@@ -61,12 +61,12 @@ IceUtil::ThreadControl::detach()
{
if(_handle == 0)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
if(CloseHandle(_handle) == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -120,7 +120,7 @@ WINAPI startHook(void* arg)
try
{
- IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
+ IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
//
// Initialize the random number generator in each thread.
@@ -128,25 +128,25 @@ WINAPI startHook(void* arg)
unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
srand(seed);
- //
- // Ensure that the thread doesn't go away until run() has
- // completed.
- //
- thread = rawThread;
-
- //
- // See the comment in IceUtil::Thread::start() for details.
- //
- rawThread->__decRef();
- thread->run();
+ //
+ // Ensure that the thread doesn't go away until run() has
+ // completed.
+ //
+ thread = rawThread;
+
+ //
+ // See the comment in IceUtil::Thread::start() for details.
+ //
+ rawThread->__decRef();
+ thread->run();
}
catch(const IceUtil::Exception& e)
{
- fprintf(stderr, "IceUtil::Thread::run(): uncaught exception: %s\n", e.toString().c_str());
+ fprintf(stderr, "IceUtil::Thread::run(): uncaught exception: %s\n", e.toString().c_str());
}
catch(...)
{
- fprintf(stderr, "IceUtil::Thread::run(): uncaught exception\n");
+ fprintf(stderr, "IceUtil::Thread::run(): uncaught exception\n");
}
thread->_done();
@@ -169,7 +169,7 @@ IceUtil::Thread::start(size_t stackSize)
if(_started)
{
- throw ThreadStartedException(__FILE__, __LINE__);
+ throw ThreadStartedException(__FILE__, __LINE__);
}
//
@@ -185,26 +185,26 @@ IceUtil::Thread::start(size_t stackSize)
#ifdef _WIN32_WCE
_handle = CreateThread(0, stackSize,
- startHook, this, 0, &_id);
+ startHook, this, 0, &_id);
#else
unsigned int id;
_handle =
- reinterpret_cast<HANDLE>(
- _beginthreadex(0,
- static_cast<unsigned int>(stackSize),
- startHook, this, 0, &id));
+ reinterpret_cast<HANDLE>(
+ _beginthreadex(0,
+ static_cast<unsigned int>(stackSize),
+ startHook, this, 0, &id));
_id = id;
#endif
if(_handle == 0)
{
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
_started = true;
_running = true;
-
+
return ThreadControl(_handle, _id);
}
@@ -214,7 +214,7 @@ IceUtil::Thread::getThreadControl() const
IceUtil::Mutex::Lock lock(_stateMutex);
if(!_started)
{
- throw ThreadNotStartedException(__FILE__, __LINE__);
+ throw ThreadNotStartedException(__FILE__, __LINE__);
}
return ThreadControl(_handle, _id);
}
@@ -283,14 +283,14 @@ IceUtil::ThreadControl::join()
{
if(!_detachable)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
void* ignore = 0;
int rc = pthread_join(_thread, &ignore);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -299,13 +299,13 @@ IceUtil::ThreadControl::detach()
{
if(!_detachable)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
int rc = pthread_detach(_thread);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -354,23 +354,23 @@ startHook(void* arg)
try
{
- IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
+ IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
- thread = rawThread;
+ thread = rawThread;
- //
- // See the comment in IceUtil::Thread::start() for details.
- //
- rawThread->__decRef();
- thread->run();
+ //
+ // See the comment in IceUtil::Thread::start() for details.
+ //
+ rawThread->__decRef();
+ thread->run();
}
catch(const IceUtil::Exception& e)
{
- fprintf(stderr, "IceUtil::Thread::run(): uncaught exception: %s\n", e.toString().c_str());
+ fprintf(stderr, "IceUtil::Thread::run(): uncaught exception: %s\n", e.toString().c_str());
}
catch(...)
{
- fprintf(stderr, "IceUtil::Thread::run(): uncaught exception\n");
+ fprintf(stderr, "IceUtil::Thread::run(): uncaught exception\n");
}
thread->_done();
@@ -390,7 +390,7 @@ IceUtil::Thread::start(size_t stackSize)
if(_started)
{
- throw ThreadStartedException(__FILE__, __LINE__);
+ throw ThreadStartedException(__FILE__, __LINE__);
}
//
@@ -406,34 +406,34 @@ IceUtil::Thread::start(size_t stackSize)
if(stackSize > 0)
{
- pthread_attr_t attr;
- int rc = pthread_attr_init(&attr);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
- rc = pthread_attr_setstacksize(&attr, stackSize);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
- rc = pthread_create(&_thread, &attr, startHook, this);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ pthread_attr_t attr;
+ int rc = pthread_attr_init(&attr);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
+ rc = pthread_attr_setstacksize(&attr, stackSize);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
+ rc = pthread_create(&_thread, &attr, startHook, this);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
else
{
- int rc = pthread_create(&_thread, 0, startHook, this);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ int rc = pthread_create(&_thread, 0, startHook, this);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
_started = true;
@@ -448,7 +448,7 @@ IceUtil::Thread::getThreadControl() const
IceUtil::Mutex::Lock lock(_stateMutex);
if(!_started)
{
- throw ThreadNotStartedException(__FILE__, __LINE__);
+ throw ThreadNotStartedException(__FILE__, __LINE__);
}
return ThreadControl(_thread);
}
diff --git a/cppe/src/IceE/ThreadException.cpp b/cppe/src/IceE/ThreadException.cpp
index 0cde7200156..1915f7f6431 100644
--- a/cppe/src/IceE/ThreadException.cpp
+++ b/cppe/src/IceE/ThreadException.cpp
@@ -32,33 +32,33 @@ IceUtil::ThreadSyscallException::toString() const
string out = Exception::toString();
if(_error != 0)
{
- out += ":\nthread syscall exception: ";
+ out += ":\nthread syscall exception: ";
#ifdef _WIN32_WCE
- out += Ice::printfToString("thread error: %d", _error);
+ out += Ice::printfToString("thread error: %d", _error);
#elif defined(_WIN32)
- LPVOID lpMsgBuf = 0;
- DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- _error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
-
- if(ok)
- {
- LPCTSTR msg = (LPCTSTR)lpMsgBuf;
- assert(msg && strlen((char*)msg) > 0);
- out += reinterpret_cast<const char*>(msg);
- LocalFree(lpMsgBuf);
- }
- else
- {
- out += "unknown thread error: ";
- out += Ice::printfToString("error=%d", _error);
- }
+ LPVOID lpMsgBuf = 0;
+ DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ _error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR)&lpMsgBuf,
+ 0,
+ NULL);
+
+ if(ok)
+ {
+ LPCTSTR msg = (LPCTSTR)lpMsgBuf;
+ assert(msg && strlen((char*)msg) > 0);
+ out += reinterpret_cast<const char*>(msg);
+ LocalFree(lpMsgBuf);
+ }
+ else
+ {
+ out += "unknown thread error: ";
+ out += Ice::printfToString("error=%d", _error);
+ }
#else
out += strerror(_error);
#endif
diff --git a/cppe/src/IceE/TraceUtil.cpp b/cppe/src/IceE/TraceUtil.cpp
index fe5f9e2b68f..f0267bdf595 100644
--- a/cppe/src/IceE/TraceUtil.cpp
+++ b/cppe/src/IceE/TraceUtil.cpp
@@ -55,29 +55,29 @@ printRequestHeader(string& s, BasicStream& stream)
s += Ice::printfToString("\nmode = %d ", static_cast<int>(mode));
switch(mode)
{
- case Normal:
- {
- s += "(normal)";
- break;
- }
-
- case Nonmutating:
- {
- s += "(nonmutating)";
- break;
- }
-
- case Idempotent:
- {
- s += "(idempotent)";
- break;
- }
-
- default:
- {
- s += "(unknown)";
- break;
- }
+ case Normal:
+ {
+ s += "(normal)";
+ break;
+ }
+
+ case Nonmutating:
+ {
+ s += "(nonmutating)";
+ break;
+ }
+
+ case Idempotent:
+ {
+ s += "(idempotent)";
+ break;
+ }
+
+ default:
+ {
+ s += "(unknown)";
+ break;
+ }
}
Int sz;
@@ -85,16 +85,16 @@ printRequestHeader(string& s, BasicStream& stream)
s += "\ncontext = ";
while(sz--)
{
- pair<string, string> pair;
- stream.read(pair.first);
- stream.read(pair.second);
- s += pair.first;
- s += "/";
- s += pair.second;
- if(sz)
- {
- s += ", ";
- }
+ pair<string, string> pair;
+ stream.read(pair.first);
+ stream.read(pair.second);
+ s += pair.first;
+ s += "/";
+ s += pair.second;
+ if(sz)
+ {
+ s += ", ";
+ }
}
}
@@ -102,7 +102,7 @@ static void
printHeader(string& s, BasicStream& stream)
{
Byte magicNumber;
- stream.read(magicNumber); // Don't bother printing the magic number
+ stream.read(magicNumber); // Don't bother printing the magic number
stream.read(magicNumber);
stream.read(magicNumber);
stream.read(magicNumber);
@@ -127,41 +127,41 @@ printHeader(string& s, BasicStream& stream)
switch(type)
{
- case requestMsg:
- {
- s += "(request)";
- break;
- }
-
- case requestBatchMsg:
- {
- s += "(batch request)";
- break;
- }
-
- case replyMsg:
- {
- s += "(reply)";
- break;
- }
-
- case closeConnectionMsg:
- {
- s += "(close connection)";
- break;
- }
-
- case validateConnectionMsg:
- {
- s += "(validate connection)";
- break;
- }
-
- default:
- {
- s += "(unknown)";
- break;
- }
+ case requestMsg:
+ {
+ s += "(request)";
+ break;
+ }
+
+ case requestBatchMsg:
+ {
+ s += "(batch request)";
+ break;
+ }
+
+ case replyMsg:
+ {
+ s += "(reply)";
+ break;
+ }
+
+ case closeConnectionMsg:
+ {
+ s += "(close connection)";
+ break;
+ }
+
+ case validateConnectionMsg:
+ {
+ s += "(validate connection)";
+ break;
+ }
+
+ default:
+ {
+ s += "(unknown)";
+ break;
+ }
}
Byte compress;
@@ -170,29 +170,29 @@ printHeader(string& s, BasicStream& stream)
switch(compress)
{
- case 0:
- {
- s += "(not compressed; do not compress response, if any)";
- break;
- }
-
- case 1:
- {
- s += "(not compressed; compress response, if any)";
- break;
- }
-
- case 2:
- {
- s += "(compressed; compress response, if any)";
- break;
- }
-
- default:
- {
- s += "(unknown)";
- break;
- }
+ case 0:
+ {
+ s += "(not compressed; do not compress response, if any)";
+ break;
+ }
+
+ case 1:
+ {
+ s += "(not compressed; compress response, if any)";
+ break;
+ }
+
+ case 2:
+ {
+ s += "(compressed; compress response, if any)";
+ break;
+ }
+
+ default:
+ {
+ s += "(unknown)";
+ break;
+ }
}
Int size;
@@ -202,7 +202,7 @@ printHeader(string& s, BasicStream& stream)
void
IceInternal::traceHeader(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -217,7 +217,7 @@ IceInternal::traceHeader(const char* heading, const BasicStream& str, const Logg
void
IceInternal::traceRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -231,7 +231,7 @@ IceInternal::traceRequest(const char* heading, const BasicStream& str, const Log
s += Ice::printfToString("\nrequest id = %d", requestId);
if(requestId == 0)
{
- s += " (oneway)";
+ s += " (oneway)";
}
printRequestHeader(s, stream);
@@ -243,7 +243,7 @@ IceInternal::traceRequest(const char* heading, const BasicStream& str, const Log
#ifdef ICEE_HAS_BATCH
void
IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -258,9 +258,9 @@ IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, cons
for(int i = 0; i < batchRequestNum; ++i)
{
- s += Ice::printfToString("\nrequest #%d:", i);
- printRequestHeader(s, stream);
- stream.skipEncaps();
+ s += Ice::printfToString("\nrequest #%d:", i);
+ printRequestHeader(s, stream);
+ stream.skipEncaps();
}
logger->trace(tl->protocolCat, s);
@@ -270,7 +270,7 @@ IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, cons
void
IceInternal::traceReply(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -290,93 +290,93 @@ IceInternal::traceReply(const char* heading, const BasicStream& str, const Logge
{
case replyOK:
{
- s += "(ok)";
- break;
+ s += "(ok)";
+ break;
}
case replyUserException:
{
- s += "(user exception)";
- break;
+ s += "(user exception)";
+ break;
}
case replyObjectNotExist:
case replyFacetNotExist:
case replyOperationNotExist:
{
- switch(replyStatus)
- {
- case replyObjectNotExist:
- {
- s += "(object not exist)";
- break;
- }
-
- case replyFacetNotExist:
- {
- s += "(facet not exist)";
- break;
- }
-
- case replyOperationNotExist:
- {
- s += "(operation not exist)";
- break;
- }
-
- default:
- {
- assert(false);
- break;
- }
- }
-
- printIdentityFacetOperation(s, stream);
- break;
+ switch(replyStatus)
+ {
+ case replyObjectNotExist:
+ {
+ s += "(object not exist)";
+ break;
+ }
+
+ case replyFacetNotExist:
+ {
+ s += "(facet not exist)";
+ break;
+ }
+
+ case replyOperationNotExist:
+ {
+ s += "(operation not exist)";
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ printIdentityFacetOperation(s, stream);
+ break;
}
case replyUnknownException:
case replyUnknownLocalException:
case replyUnknownUserException:
{
- switch(replyStatus)
- {
- case replyUnknownException:
- {
- s += "(unknown exception)";
- break;
- }
-
- case replyUnknownLocalException:
- {
- s += "(unknown local exception)";
- break;
- }
-
- case replyUnknownUserException:
- {
- s += "(unknown user exception)";
- break;
- }
-
- default:
- {
- assert(false);
- break;
- }
- }
-
- string unknown;
- stream.read(unknown);
- s += "\nunknown = ";
- s += unknown;
- break;
+ switch(replyStatus)
+ {
+ case replyUnknownException:
+ {
+ s += "(unknown exception)";
+ break;
+ }
+
+ case replyUnknownLocalException:
+ {
+ s += "(unknown local exception)";
+ break;
+ }
+
+ case replyUnknownUserException:
+ {
+ s += "(unknown user exception)";
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ string unknown;
+ stream.read(unknown);
+ s += "\nunknown = ";
+ s += unknown;
+ break;
}
default:
{
- s += "(unknown)";
- break;
+ s += "(unknown)";
+ break;
}
}
diff --git a/cppe/src/IceE/Transceiver.h b/cppe/src/IceE/Transceiver.h
index 36a7ecaa8bf..a3cbbaafdec 100644
--- a/cppe/src/IceE/Transceiver.h
+++ b/cppe/src/IceE/Transceiver.h
@@ -45,12 +45,12 @@ public:
void write(Buffer& buf)
{
- writeWithTimeout(buf, _writeTimeout);
+ writeWithTimeout(buf, _writeTimeout);
}
void read(Buffer& buf)
{
- readWithTimeout(buf, _readTimeout);
+ readWithTimeout(buf, _readTimeout);
}
std::string type() const;
diff --git a/cppe/src/IceE/UUID.cpp b/cppe/src/IceE/UUID.cpp
index de7fba90512..d3847e581cd 100644
--- a/cppe/src/IceE/UUID.cpp
+++ b/cppe/src/IceE/UUID.cpp
@@ -42,11 +42,11 @@ inline void halfByteToHex(unsigned char hb, char*& hexBuffer)
{
if(hb < 10)
{
- *hexBuffer++ = '0' + hb;
+ *hexBuffer++ = '0' + hb;
}
else
{
- *hexBuffer++ = 'A' + (hb - 10);
+ *hexBuffer++ = 'A' + (hb - 10);
}
}
@@ -54,8 +54,8 @@ inline void bytesToHex(unsigned char* bytes, size_t len, char*& hexBuffer)
{
for(size_t i = 0; i < len; i++)
{
- halfByteToHex((bytes[i] & 0xF0) >> 4, hexBuffer);
- halfByteToHex((bytes[i] & 0x0F), hexBuffer);
+ halfByteToHex((bytes[i] & 0xF0) >> 4, hexBuffer);
+ halfByteToHex((bytes[i] & 0x0F), hexBuffer);
}
}
@@ -84,12 +84,12 @@ public:
~UUIDCleanup()
{
- IceUtil::StaticMutex::Lock lock(staticMutex);
- if(cryptProv != 0)
- {
- CryptReleaseContext(cryptProv, 0);
- cryptProv = 0;
- }
+ IceUtil::StaticMutex::Lock lock(staticMutex);
+ if(cryptProv != 0)
+ {
+ CryptReleaseContext(cryptProv, 0);
+ cryptProv = 0;
+ }
}
};
@@ -125,12 +125,12 @@ public:
~UUIDCleanup()
{
- IceUtil::StaticMutex::Lock lock(staticMutex);
- if(fd != -1)
- {
- close(fd);
- fd = -1;
- }
+ IceUtil::StaticMutex::Lock lock(staticMutex);
+ if(fd != -1)
+ {
+ close(fd);
+ fd = -1;
+ }
}
};
static UUIDCleanup uuidCleanup;
@@ -179,12 +179,12 @@ IceUtil::generateUUID()
struct UUID
{
- unsigned char timeLow[4];
- unsigned char timeMid[2];
- unsigned char timeHighAndVersion[2];
- unsigned char clockSeqHiAndReserved;
- unsigned char clockSeqLow;
- unsigned char node[6];
+ unsigned char timeLow[4];
+ unsigned char timeMid[2];
+ unsigned char timeHighAndVersion[2];
+ unsigned char clockSeqHiAndReserved;
+ unsigned char clockSeqLow;
+ unsigned char node[6];
};
UUID uuid;
@@ -199,74 +199,74 @@ IceUtil::generateUUID()
HCRYPTPROV localProv;
{
- IceUtil::StaticMutex::Lock lock(staticMutex);
- if(cryptProv == 0)
- {
- if(!CryptAcquireContext(&cryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
- {
- throw UUIDGenerationException(__FILE__, __LINE__);
- }
- }
- localProv = cryptProv;
+ IceUtil::StaticMutex::Lock lock(staticMutex);
+ if(cryptProv == 0)
+ {
+ if(!CryptAcquireContext(&cryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+ {
+ throw UUIDGenerationException(__FILE__, __LINE__);
+ }
+ }
+ localProv = cryptProv;
}
memset(buffer, 0, 16);
if(!CryptGenRandom(localProv, 16, (unsigned char*)buffer))
{
- throw UUIDGenerationException(__FILE__, __LINE__);
+ throw UUIDGenerationException(__FILE__, __LINE__);
}
#else
{
- //
- // Serialize access to /dev/urandom; see comment above.
- //
- IceUtil::StaticMutex::Lock lock(staticMutex);
- if(fd == -1)
- {
- fd = open("/dev/urandom", O_RDONLY);
- if (fd == -1)
- {
- assert(0);
- throw UUIDGenerationException(__FILE__, __LINE__);
- }
-
- //
- // Initialize myPid as well
- //
- pid_t pid = getpid();
- myPid[0] = (pid >> 8) & 0x7F;
- myPid[1] = pid & 0xFF;
- }
-
-
- //
- // Limit the number of attempts to 20 reads to avoid
- // a potential "for ever" loop
- //
- while(reads <= 20 && index != sizeof(UUID))
- {
- ssize_t bytesRead = read(fd, buffer + index, sizeof(UUID) - index);
-
- if(bytesRead == -1 && errno != EINTR)
- {
- int err = errno;
- fprintf(stderr, "Reading /dev/urandom returned %s\n", strerror(err));
- assert(0);
- throw UUIDGenerationException(__FILE__, __LINE__);
- }
- else
- {
- index += bytesRead;
- reads++;
- }
- }
+ //
+ // Serialize access to /dev/urandom; see comment above.
+ //
+ IceUtil::StaticMutex::Lock lock(staticMutex);
+ if(fd == -1)
+ {
+ fd = open("/dev/urandom", O_RDONLY);
+ if (fd == -1)
+ {
+ assert(0);
+ throw UUIDGenerationException(__FILE__, __LINE__);
+ }
+
+ //
+ // Initialize myPid as well
+ //
+ pid_t pid = getpid();
+ myPid[0] = (pid >> 8) & 0x7F;
+ myPid[1] = pid & 0xFF;
+ }
+
+
+ //
+ // Limit the number of attempts to 20 reads to avoid
+ // a potential "for ever" loop
+ //
+ while(reads <= 20 && index != sizeof(UUID))
+ {
+ ssize_t bytesRead = read(fd, buffer + index, sizeof(UUID) - index);
+
+ if(bytesRead == -1 && errno != EINTR)
+ {
+ int err = errno;
+ fprintf(stderr, "Reading /dev/urandom returned %s\n", strerror(err));
+ assert(0);
+ throw UUIDGenerationException(__FILE__, __LINE__);
+ }
+ else
+ {
+ index += bytesRead;
+ reads++;
+ }
+ }
}
-
+
if (index != sizeof(UUID))
{
- assert(0);
- throw UUIDGenerationException(__FILE__, __LINE__);
+ assert(0);
+ throw UUIDGenerationException(__FILE__, __LINE__);
}
//
diff --git a/cppe/src/IceE/Unicode.cpp b/cppe/src/IceE/Unicode.cpp
index c1a17286041..facd380e1a3 100644
--- a/cppe/src/IceE/Unicode.cpp
+++ b/cppe/src/IceE/Unicode.cpp
@@ -27,35 +27,35 @@ template<size_t wcharSize>
struct WstringHelper
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
};
template<>
struct WstringHelper<2>
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
- return ConvertUTF16toUTF8(
- reinterpret_cast<const UTF16**>(&sourceStart),
- reinterpret_cast<const UTF16*>(sourceEnd),
- &targetStart, targetEnd, flags);
+ return ConvertUTF16toUTF8(
+ reinterpret_cast<const UTF16**>(&sourceStart),
+ reinterpret_cast<const UTF16*>(sourceEnd),
+ &targetStart, targetEnd, flags);
}
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
- return ConvertUTF8toUTF16(
- &sourceStart, sourceEnd,
- reinterpret_cast<UTF16**>(&targetStart),
- reinterpret_cast<UTF16*>(targetEnd), flags);
+ return ConvertUTF8toUTF16(
+ &sourceStart, sourceEnd,
+ reinterpret_cast<UTF16**>(&targetStart),
+ reinterpret_cast<UTF16*>(targetEnd), flags);
}
};
@@ -63,23 +63,23 @@ template<>
struct WstringHelper<4>
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
- return ConvertUTF32toUTF8(
- reinterpret_cast<const UTF32**>(&sourceStart),
- reinterpret_cast<const UTF32*>(sourceEnd),
- &targetStart, targetEnd, flags);
+ return ConvertUTF32toUTF8(
+ reinterpret_cast<const UTF32**>(&sourceStart),
+ reinterpret_cast<const UTF32*>(sourceEnd),
+ &targetStart, targetEnd, flags);
}
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
- return ConvertUTF8toUTF32(
- &sourceStart, sourceEnd,
- reinterpret_cast<UTF32**>(&targetStart),
- reinterpret_cast<UTF32*>(targetEnd), flags);
+ return ConvertUTF8toUTF32(
+ &sourceStart, sourceEnd,
+ reinterpret_cast<UTF32**>(&targetStart),
+ reinterpret_cast<UTF32*>(targetEnd), flags);
}
};
}
@@ -94,7 +94,7 @@ IceUtil::convertUTFWstringToUTF8(
Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
return WstringHelper<sizeof(wchar_t)>::toUTF8(
- sourceStart, sourceEnd, targetStart, targetEnd, flags);
+ sourceStart, sourceEnd, targetStart, targetEnd, flags);
}
ConversionResult
@@ -103,12 +103,12 @@ IceUtil::convertUTF8ToUTFWstring(
wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
return WstringHelper<sizeof(wchar_t)>::fromUTF8(
- sourceStart, sourceEnd, targetStart, targetEnd, flags);
+ sourceStart, sourceEnd, targetStart, targetEnd, flags);
}
ConversionResult
IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd,
- std::wstring& target, ConversionFlags flags)
+ std::wstring& target, ConversionFlags flags)
{
//
// Could be reimplemented without this temporary wchar_t buffer
@@ -119,13 +119,13 @@ IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd
wchar_t* targetEnd = targetStart + size;
ConversionResult result =
- convertUTF8ToUTFWstring(sourceStart, sourceEnd, targetStart,
- targetEnd, flags);
+ convertUTF8ToUTFWstring(sourceStart, sourceEnd, targetStart,
+ targetEnd, flags);
if(result == conversionOK)
{
- std::wstring s(outBuf, static_cast<size_t>(targetStart - outBuf));
- s.swap(target);
+ std::wstring s(outBuf, static_cast<size_t>(targetStart - outBuf));
+ s.swap(target);
}
delete[] outBuf;
return result;
@@ -139,7 +139,7 @@ IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd
const char* IceUtil::UTFConversionException::_name = "IceUtil::UTFConversionException";
IceUtil::UTFConversionException::UTFConversionException(const char* file, int line,
- ConversionResult cr):
+ ConversionResult cr):
Exception(file, line),
_conversionResult(cr)
{}
@@ -156,18 +156,18 @@ IceUtil::UTFConversionException::toString() const
string str = Exception::toString();
switch(_conversionResult)
{
- case sourceExhausted:
- str += ": source exhausted";
- break;
- case targetExhausted:
- str += ": target exhausted";
- break;
- case sourceIllegal:
- str += ": illegal source";
- break;
- default:
- assert(0);
- break;
+ case sourceExhausted:
+ str += ": source exhausted";
+ break;
+ case targetExhausted:
+ str += ": target exhausted";
+ break;
+ case sourceIllegal:
+ str += ": illegal source";
+ break;
+ default:
+ assert(0);
+ break;
};
return str;
}
@@ -205,18 +205,18 @@ IceUtil::wstringToString(const wstring& wstr)
const wchar_t* sourceStart = wstr.data();
ConversionResult cr =
- convertUTFWstringToUTF8(
- sourceStart, sourceStart + wstr.size(),
- targetStart, targetEnd, lenientConversion);
-
+ convertUTFWstringToUTF8(
+ sourceStart, sourceStart + wstr.size(),
+ targetStart, targetEnd, lenientConversion);
+
if(cr != conversionOK)
{
- delete[] outBuf;
- throw UTFConversionException(__FILE__, __LINE__, cr);
+ delete[] outBuf;
+ throw UTFConversionException(__FILE__, __LINE__, cr);
}
string s(reinterpret_cast<char*>(outBuf),
- static_cast<size_t>(targetStart - outBuf));
+ static_cast<size_t>(targetStart - outBuf));
s.swap(target);
delete[] outBuf;
return target;
@@ -229,12 +229,12 @@ IceUtil::stringToWstring(const string& str)
const Byte* sourceStart = reinterpret_cast<const Byte*>(str.data());
ConversionResult cr
- = convertUTF8ToUTFWstring(sourceStart, sourceStart + str.size(),
- result, lenientConversion);
+ = convertUTF8ToUTFWstring(sourceStart, sourceStart + str.size(),
+ result, lenientConversion);
if(cr != conversionOK)
{
- throw UTFConversionException(__FILE__, __LINE__, cr);
+ throw UTFConversionException(__FILE__, __LINE__, cr);
}
return result;
}
diff --git a/cppe/src/IceE/UnknownEndpoint.cpp b/cppe/src/IceE/UnknownEndpoint.cpp
index dee2bd5004f..3792a012c16 100644
--- a/cppe/src/IceE/UnknownEndpoint.cpp
+++ b/cppe/src/IceE/UnknownEndpoint.cpp
@@ -114,12 +114,12 @@ IceInternal::UnknownEndpoint::operator==(const Endpoint& r) const
const UnknownEndpoint* p = dynamic_cast<const UnknownEndpoint*>(&r);
if(!p)
{
- return false;
+ return false;
}
if(this == p)
{
- return true;
+ return true;
}
if(_type != p->_type)
@@ -129,7 +129,7 @@ IceInternal::UnknownEndpoint::operator==(const Endpoint& r) const
if(_rawBytes != p->_rawBytes)
{
- return false;
+ return false;
}
return true;
@@ -152,25 +152,25 @@ IceInternal::UnknownEndpoint::operator<(const Endpoint& r) const
if(this == p)
{
- return false;
+ return false;
}
if(_type < p->_type)
{
- return true;
+ return true;
}
else if(p->_type < _type)
{
- return false;
+ return false;
}
if(_rawBytes < p->_rawBytes)
{
- return true;
+ return true;
}
else if(p->_rawBytes < _rawBytes)
{
- return false;
+ return false;
}
return false;
diff --git a/cppe/src/TcpTransport/Acceptor.cpp b/cppe/src/TcpTransport/Acceptor.cpp
index 28f2b74b43a..477eb7b7adb 100644
--- a/cppe/src/TcpTransport/Acceptor.cpp
+++ b/cppe/src/TcpTransport/Acceptor.cpp
@@ -32,8 +32,8 @@ IceInternal::Acceptor::close()
{
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "stopping to accept tcp connections at " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "stopping to accept tcp connections at " << toString();
}
SOCKET fd = _fd;
@@ -46,18 +46,18 @@ IceInternal::Acceptor::listen()
{
try
{
- doListen(_fd, _backlog);
+ doListen(_fd, _backlog);
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "accepting tcp connections at " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "accepting tcp connections at " << toString();
}
}
@@ -72,8 +72,8 @@ IceInternal::Acceptor::accept()
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "accepted tcp connection\n" << fdToString(fd);
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "accepted tcp connection\n" << fdToString(fd);
}
return new Transceiver(_instance, fd);
@@ -113,8 +113,8 @@ IceInternal::Acceptor::Acceptor(const InstancePtr& instance, const string& host,
try
{
- _fd = createSocket();
- getAddress(host, port, _addr);
+ _fd = createSocket();
+ getAddress(host, port, _addr);
setTcpBufSize(_fd, _instance->initializationData().properties, _logger);
#ifndef _WIN32
//
@@ -131,17 +131,17 @@ IceInternal::Acceptor::Acceptor(const InstancePtr& instance, const string& host,
//
setReuseAddress(_fd, true);
#endif
- if(_traceLevels->network >= 2)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "attempting to bind to tcp socket " << toString();
- }
- doBind(_fd, _addr);
+ if(_traceLevels->network >= 2)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "attempting to bind to tcp socket " << toString();
+ }
+ doBind(_fd, _addr);
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
}
diff --git a/cppe/src/TcpTransport/Connector.cpp b/cppe/src/TcpTransport/Connector.cpp
index 98d3b95a364..52209fcda50 100644
--- a/cppe/src/TcpTransport/Connector.cpp
+++ b/cppe/src/TcpTransport/Connector.cpp
@@ -26,8 +26,8 @@ Connector::connect(int timeout)
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "trying to establish tcp connection to " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "trying to establish tcp connection to " << toString();
}
SOCKET fd = createSocket();
@@ -40,8 +40,8 @@ Connector::connect(int timeout)
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "tcp connection established\n" << fdToString(fd);
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "tcp connection established\n" << fdToString(fd);
}
return new Transceiver(_instance, fd);
diff --git a/cppe/src/TcpTransport/EndpointFactory.cpp b/cppe/src/TcpTransport/EndpointFactory.cpp
index 7ac68524733..c6207020d38 100644
--- a/cppe/src/TcpTransport/EndpointFactory.cpp
+++ b/cppe/src/TcpTransport/EndpointFactory.cpp
@@ -51,7 +51,7 @@ IceInternal::EndpointFactory::create(const std::string& str) const
if(protocol == "default" || protocol == "tcp")
{
- return new TcpEndpoint(_instance, str.substr(end));
+ return new TcpEndpoint(_instance, str.substr(end));
}
return 0;
diff --git a/cppe/src/TcpTransport/TcpEndpoint.cpp b/cppe/src/TcpTransport/TcpEndpoint.cpp
index 93e4a9efdca..88adf42bf94 100644
--- a/cppe/src/TcpTransport/TcpEndpoint.cpp
+++ b/cppe/src/TcpTransport/TcpEndpoint.cpp
@@ -46,90 +46,90 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string&
while(true)
{
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
-
- string option = str.substr(beg, end - beg);
- if(option.length() != 2 || option[0] != '-')
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
-
- string argument;
- string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if(argumentBeg != string::npos && str[argumentBeg] != '-')
- {
- beg = argumentBeg;
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
- argument = str.substr(beg, end - beg);
- }
-
- switch(option[1])
- {
- case 'h':
- {
- if(argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- const_cast<string&>(_host) = argument;
- break;
- }
-
- case 'p':
- {
- const_cast<Int&>(_port) = atoi(argument.c_str());
- if(_port <= 0 || _port > 65535)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- break;
- }
-
- case 't':
- {
- const_cast<Int&>(_timeout) = atoi(argument.c_str());
- if(_timeout == 0)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- break;
- }
-
- case 'z':
- {
- // Ignore compression flag.
- break;
- }
-
- default:
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+
+ string option = str.substr(beg, end - beg);
+ if(option.length() != 2 || option[0] != '-')
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+
+ string argument;
+ string::size_type argumentBeg = str.find_first_not_of(delim, end);
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
+ {
+ beg = argumentBeg;
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+ argument = str.substr(beg, end - beg);
+ }
+
+ switch(option[1])
+ {
+ case 'h':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ const_cast<string&>(_host) = argument;
+ break;
+ }
+
+ case 'p':
+ {
+ const_cast<Int&>(_port) = atoi(argument.c_str());
+ if(_port <= 0 || _port > 65535)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 't':
+ {
+ const_cast<Int&>(_timeout) = atoi(argument.c_str());
+ if(_timeout == 0)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 'z':
+ {
+ // Ignore compression flag.
+ break;
+ }
+
+ default:
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ }
}
}
@@ -194,11 +194,11 @@ IceInternal::TcpEndpoint::timeout(Int timeout) const
{
if(timeout == _timeout)
{
- return const_cast<TcpEndpoint*>(this);
+ return const_cast<TcpEndpoint*>(this);
}
else
{
- return new TcpEndpoint(_instance, _host, _port, timeout, _publish);
+ return new TcpEndpoint(_instance, _host, _port, timeout, _publish);
}
}
@@ -232,42 +232,42 @@ IceInternal::TcpEndpoint::operator==(const Endpoint& r) const
const TcpEndpoint* p = dynamic_cast<const TcpEndpoint*>(&r);
if(!p)
{
- return false;
+ return false;
}
if(this == p)
{
- return true;
+ return true;
}
if(_port != p->_port)
{
- return false;
+ return false;
}
if(_timeout != p->_timeout)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- struct sockaddr_in raddr;
- try
- {
- getAddress(_host, _port, laddr);
- getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- return false;
- }
-
- return compareAddress(laddr, raddr);
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ struct sockaddr_in raddr;
+ try
+ {
+ getAddress(_host, _port, laddr);
+ getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ return false;
+ }
+
+ return compareAddress(laddr, raddr);
}
return true;
@@ -285,63 +285,63 @@ IceInternal::TcpEndpoint::operator<(const Endpoint& r) const
const TcpEndpoint* p = dynamic_cast<const TcpEndpoint*>(&r);
if(!p)
{
- return type() < r.type();
+ return type() < r.type();
}
if(this == p)
{
- return false;
+ return false;
}
if(_port < p->_port)
{
- return true;
+ return true;
}
else if(p->_port < _port)
{
- return false;
+ return false;
}
if(_timeout < p->_timeout)
{
- return true;
+ return true;
}
else if(p->_timeout < _timeout)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- try
- {
- getAddress(_host, _port, laddr);
- }
- catch(const DNSException&)
- {
- }
-
- struct sockaddr_in raddr;
- try
- {
- getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- }
-
- if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
- {
- return true;
- }
- else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
- {
- return false;
- }
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ try
+ {
+ getAddress(_host, _port, laddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ struct sockaddr_in raddr;
+ try
+ {
+ getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
+ {
+ return true;
+ }
+ else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
+ {
+ return false;
+ }
}
return false;
@@ -355,14 +355,14 @@ IceInternal::TcpEndpoint::expand(bool server) const
const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost;
if(_host.empty())
{
- if(server)
- {
+ if(server)
+ {
const_cast<string&>(_host) = "0.0.0.0";
- }
- else
- {
+ }
+ else
+ {
const_cast<string&>(_host) = "127.0.0.1";
- }
+ }
}
}
else if(_host == "*")
diff --git a/cppe/src/TcpTransport/Transceiver.cpp b/cppe/src/TcpTransport/Transceiver.cpp
index 6ab0d9b06c8..fa31d1cdd29 100644
--- a/cppe/src/TcpTransport/Transceiver.cpp
+++ b/cppe/src/TcpTransport/Transceiver.cpp
@@ -48,8 +48,8 @@ IceInternal::Transceiver::close()
{
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "closing tcp connection\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "closing tcp connection\n" << toString();
}
#ifdef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
@@ -67,13 +67,13 @@ IceInternal::Transceiver::close()
assert(_fd != INVALID_SOCKET);
try
{
- closeSocket(_fd);
- _fd = INVALID_SOCKET;
+ closeSocket(_fd);
+ _fd = INVALID_SOCKET;
}
catch(const SocketException&)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
}
@@ -82,8 +82,8 @@ IceInternal::Transceiver::shutdownWrite()
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "shutting down tcp connection for writing\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "shutting down tcp connection for writing\n" << toString();
}
assert(_fd != INVALID_SOCKET);
@@ -95,8 +95,8 @@ IceInternal::Transceiver::shutdownReadWrite()
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "shutting down tcp connection for reading and writing\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "shutting down tcp connection for reading and writing\n" << toString();
}
assert(_fd != INVALID_SOCKET);
@@ -115,113 +115,113 @@ IceInternal::Transceiver::writeWithTimeout(Buffer& buf, int timeout)
//
if(packetSize > _maxPacketSize)
{
- packetSize = _maxPacketSize;
+ packetSize = _maxPacketSize;
}
#endif
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
if(timeout > 0 && timeout != _writeTimeout)
{
- setTimeout(_fd, false, timeout);
+ setTimeout(_fd, false, timeout);
}
try
- {
+ {
#endif
- while(buf.i != buf.b.end())
- {
- repeatSend:
- assert(_fd != INVALID_SOCKET);
- ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&*buf.i), packetSize, 0);
-
- if(ret == 0)
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
- }
-
- if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatSend;
- }
-
- if(noBuffers() && packetSize > 1024)
- {
- packetSize /= 2;
- goto repeatSend;
- }
-
+ while(buf.i != buf.b.end())
+ {
+ repeatSend:
+ assert(_fd != INVALID_SOCKET);
+ ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&*buf.i), packetSize, 0);
+
+ if(ret == 0)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatSend;
+ }
+
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ goto repeatSend;
+ }
+
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
- if(timedout())
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
+ if(timedout())
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
#else
- if(wouldBlock())
- {
- doSelect(false, timeout > 0 ? timeout : _writeTimeout);
- continue;
- }
+ if(wouldBlock())
+ {
+ doSelect(false, timeout > 0 ? timeout : _writeTimeout);
+ continue;
+ }
#endif
- if(connectionLost())
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- if(_traceLevels->network >= 3)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << Ice::printfToString("sent %d of %d", ret, packetSize) << " bytes via tcp\n" << toString();
- }
-
- buf.i += ret;
-
- if(packetSize > buf.b.end() - buf.i)
- {
- packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
- }
- }
+ if(connectionLost())
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ if(_traceLevels->network >= 3)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << Ice::printfToString("sent %d of %d", ret, packetSize) << " bytes via tcp\n" << toString();
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ }
+ }
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
}
catch(const Ice::LocalException&)
{
- if(timeout > 0 && timeout != _writeTimeout)
- {
- try
- {
- setTimeout(_fd, false, _writeTimeout);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
- }
- throw;
+ if(timeout > 0 && timeout != _writeTimeout)
+ {
+ try
+ {
+ setTimeout(_fd, false, _writeTimeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
+ }
+ throw;
}
if(timeout > 0 && timeout != _writeTimeout)
{
- try
- {
- setTimeout(_fd, false, _writeTimeout);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
+ try
+ {
+ setTimeout(_fd, false, _writeTimeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
}
#endif
}
@@ -232,129 +232,129 @@ IceInternal::Transceiver::readWithTimeout(Buffer& buf, int timeout)
assert(timeout != 0);
Buffer::Container::difference_type packetSize =
- static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
if(timeout > 0 && timeout != _readTimeout)
{
- setTimeout(_fd, true, timeout);
+ setTimeout(_fd, true, timeout);
}
try
{
#endif
- while(buf.i != buf.b.end())
- {
- repeatRead:
- assert(_fd != INVALID_SOCKET);
- ssize_t ret = ::recv(_fd, reinterpret_cast<char*>(&*buf.i), packetSize, 0);
-
- if(ret == 0)
- {
- //
- // If the connection is lost when reading data, we shut
- // down the write end of the socket. This helps to unblock
- // threads that are stuck in send() or select() while
- // sending data. Note: I don't really understand why
- // send() or select() sometimes don't detect a connection
- // loss. Therefore this helper to make them detect it.
- //
- //assert(_fd != INVALID_SOCKET);
- //shutdownSocketReadWrite(_fd);
-
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
- }
-
- if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatRead;
- }
-
- if(noBuffers() && packetSize > 1024)
- {
- packetSize /= 2;
- goto repeatRead;
- }
-
+ while(buf.i != buf.b.end())
+ {
+ repeatRead:
+ assert(_fd != INVALID_SOCKET);
+ ssize_t ret = ::recv(_fd, reinterpret_cast<char*>(&*buf.i), packetSize, 0);
+
+ if(ret == 0)
+ {
+ //
+ // If the connection is lost when reading data, we shut
+ // down the write end of the socket. This helps to unblock
+ // threads that are stuck in send() or select() while
+ // sending data. Note: I don't really understand why
+ // send() or select() sometimes don't detect a connection
+ // loss. Therefore this helper to make them detect it.
+ //
+ //assert(_fd != INVALID_SOCKET);
+ //shutdownSocketReadWrite(_fd);
+
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatRead;
+ }
+
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ goto repeatRead;
+ }
+
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
- if(timedout())
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
+ if(timedout())
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
#else
- if(wouldBlock())
- {
- doSelect(true, timeout > 0 ? timeout : _readTimeout);
- continue;
- }
+ if(wouldBlock())
+ {
+ doSelect(true, timeout > 0 ? timeout : _readTimeout);
+ continue;
+ }
#endif
-
- if(connectionLost())
- {
- //
- // See the commment above about shutting down the
- // socket if the connection is lost while reading
- // data.
- //
- //assert(_fd != INVALID_SOCKET);
- //shutdownSocketReadWrite(_fd);
-
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- if(_traceLevels->network >= 3)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << Ice::printfToString("received %d of %d", ret, packetSize) << " bytes via tcp\n" << toString();
- }
-
- buf.i += ret;
-
- if(packetSize > buf.b.end() - buf.i)
- {
- packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
- }
- }
+
+ if(connectionLost())
+ {
+ //
+ // See the commment above about shutting down the
+ // socket if the connection is lost while reading
+ // data.
+ //
+ //assert(_fd != INVALID_SOCKET);
+ //shutdownSocketReadWrite(_fd);
+
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ if(_traceLevels->network >= 3)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << Ice::printfToString("received %d of %d", ret, packetSize) << " bytes via tcp\n" << toString();
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ }
+ }
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
}
catch(const Ice::LocalException&)
{
- if(timeout > 0 && timeout != _readTimeout)
- {
- try
- {
- setTimeout(_fd, true, _readTimeout);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
- }
- throw;
+ if(timeout > 0 && timeout != _readTimeout)
+ {
+ try
+ {
+ setTimeout(_fd, true, _readTimeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
+ }
+ throw;
}
if(timeout > 0 && timeout != _readTimeout)
{
- try
- {
- setTimeout(_fd, true, _readTimeout);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
+ try
+ {
+ setTimeout(_fd, true, _readTimeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
}
#endif
}
@@ -386,24 +386,24 @@ IceInternal::Transceiver::Transceiver(const InstancePtr& instance, SOCKET fd) :
_writeEvent = WSACreateEvent();
if(_event == 0 || _readEvent == 0 || _writeEvent == 0)
{
- int error = WSAGetLastError();
- if(_event != 0)
- {
- WSACloseEvent(_event);
- }
- if(_readEvent != 0)
- {
- WSACloseEvent(_readEvent);
- }
- if(_writeEvent != 0)
- {
- WSACloseEvent(_writeEvent);
- }
- closeSocket(_fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
+ int error = WSAGetLastError();
+ if(_event != 0)
+ {
+ WSACloseEvent(_event);
+ }
+ if(_readEvent != 0)
+ {
+ WSACloseEvent(_readEvent);
+ }
+ if(_writeEvent != 0)
+ {
+ WSACloseEvent(_writeEvent);
+ }
+ closeSocket(_fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
}
//
@@ -411,16 +411,16 @@ IceInternal::Transceiver::Transceiver(const InstancePtr& instance, SOCKET fd) :
//
if(WSAEventSelect(_fd, _event, FD_READ|FD_WRITE|FD_CLOSE) == SOCKET_ERROR)
{
- int error = WSAGetLastError();
+ int error = WSAGetLastError();
- WSACloseEvent(_event);
- WSACloseEvent(_readEvent);
- WSACloseEvent(_writeEvent);
- closeSocket(_fd);
+ WSACloseEvent(_event);
+ WSACloseEvent(_readEvent);
+ WSACloseEvent(_writeEvent);
+ closeSocket(_fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
}
#else
FD_ZERO(&_wFdSet);
@@ -461,151 +461,151 @@ IceInternal::Transceiver::doSelect(bool read, int timeout)
while(true)
{
#ifdef _WIN32
- //
- // This code is basically the same as the code in
- // ::send above. Check that for detailed comments.
- //
- WSAEVENT events[2];
- events[0] = _event;
- events[1] = read ? _readEvent : _writeEvent;
- long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
- DWORD rc = WSAWaitForMultipleEvents(2, events, FALSE, tout, FALSE);
- if(rc == WSA_WAIT_FAILED)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
- }
- if(rc == WSA_WAIT_TIMEOUT)
- {
- assert(timeout >= 0);
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- if(rc == WSA_WAIT_EVENT_0)
- {
- WSANETWORKEVENTS nevents;
- if(WSAEnumNetworkEvents(_fd, _event, &nevents) == SOCKET_ERROR)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
- }
-
- //
- // If we're selecting for reading and have consumed a WRITE
- // event, set the _writeEvent event. Otherwise, if we're
- // selecting for writing have consumed a READ event, set the
- // _readEvent event.
- //
- if(read && nevents.lNetworkEvents & FD_WRITE)
- {
- WSASetEvent(_writeEvent);
- }
- else if(!read && nevents.lNetworkEvents & FD_READ)
- {
- WSASetEvent(_readEvent);
- }
-
-
- //
- // This checks for an error on the fd (this would
- // be same as recv itself returning an error). In
- // the event of an error we set the error code,
- // and repeat the error handling.
- //
- if(read && nevents.lNetworkEvents & FD_READ && nevents.iErrorCode[FD_READ_BIT] != 0)
- {
- WSASetLastError(nevents.iErrorCode[FD_READ_BIT]);
- }
- else if(!read && nevents.lNetworkEvents & FD_WRITE && nevents.iErrorCode[FD_WRITE_BIT] != 0)
- {
- WSASetLastError(nevents.iErrorCode[FD_WRITE_BIT]);
- }
- else if(nevents.lNetworkEvents & FD_CLOSE && nevents.iErrorCode[FD_CLOSE_BIT] != 0)
- {
- WSASetLastError(nevents.iErrorCode[FD_CLOSE_BIT]);
- }
- else
- {
- return; // No errors: we're done.
- }
-
- if(interrupted())
- {
- continue;
- }
-
- if(connectionLost())
- {
- //
- // See the commment above about shutting down the
- // socket if the connection is lost while reading
- // data.
- //
- //assert(_fd != INVALID_SOCKET);
- //shutdownSocketReadWrite(_fd);
-
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
- else
- {
- //
- // Otherwise the _readEvent or _writeEvent is set, reset it.
- //
- if(read)
- {
- WSAResetEvent(_readEvent);
- }
- else
- {
- WSAResetEvent(_writeEvent);
- }
- return;
- }
+ //
+ // This code is basically the same as the code in
+ // ::send above. Check that for detailed comments.
+ //
+ WSAEVENT events[2];
+ events[0] = _event;
+ events[1] = read ? _readEvent : _writeEvent;
+ long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
+ DWORD rc = WSAWaitForMultipleEvents(2, events, FALSE, tout, FALSE);
+ if(rc == WSA_WAIT_FAILED)
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
+ }
+ if(rc == WSA_WAIT_TIMEOUT)
+ {
+ assert(timeout >= 0);
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ if(rc == WSA_WAIT_EVENT_0)
+ {
+ WSANETWORKEVENTS nevents;
+ if(WSAEnumNetworkEvents(_fd, _event, &nevents) == SOCKET_ERROR)
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
+ }
+
+ //
+ // If we're selecting for reading and have consumed a WRITE
+ // event, set the _writeEvent event. Otherwise, if we're
+ // selecting for writing have consumed a READ event, set the
+ // _readEvent event.
+ //
+ if(read && nevents.lNetworkEvents & FD_WRITE)
+ {
+ WSASetEvent(_writeEvent);
+ }
+ else if(!read && nevents.lNetworkEvents & FD_READ)
+ {
+ WSASetEvent(_readEvent);
+ }
+
+
+ //
+ // This checks for an error on the fd (this would
+ // be same as recv itself returning an error). In
+ // the event of an error we set the error code,
+ // and repeat the error handling.
+ //
+ if(read && nevents.lNetworkEvents & FD_READ && nevents.iErrorCode[FD_READ_BIT] != 0)
+ {
+ WSASetLastError(nevents.iErrorCode[FD_READ_BIT]);
+ }
+ else if(!read && nevents.lNetworkEvents & FD_WRITE && nevents.iErrorCode[FD_WRITE_BIT] != 0)
+ {
+ WSASetLastError(nevents.iErrorCode[FD_WRITE_BIT]);
+ }
+ else if(nevents.lNetworkEvents & FD_CLOSE && nevents.iErrorCode[FD_CLOSE_BIT] != 0)
+ {
+ WSASetLastError(nevents.iErrorCode[FD_CLOSE_BIT]);
+ }
+ else
+ {
+ return; // No errors: we're done.
+ }
+
+ if(interrupted())
+ {
+ continue;
+ }
+
+ if(connectionLost())
+ {
+ //
+ // See the commment above about shutting down the
+ // socket if the connection is lost while reading
+ // data.
+ //
+ //assert(_fd != INVALID_SOCKET);
+ //shutdownSocketReadWrite(_fd);
+
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+ else
+ {
+ //
+ // Otherwise the _readEvent or _writeEvent is set, reset it.
+ //
+ if(read)
+ {
+ WSAResetEvent(_readEvent);
+ }
+ else
+ {
+ WSAResetEvent(_writeEvent);
+ }
+ return;
+ }
#else
- int rs;
- assert(_fd != INVALID_SOCKET);
- if(read)
- {
- FD_SET(_fd, &_rFdSet);
- }
- else
- {
- FD_SET(_fd, &_wFdSet);
- }
-
+ int rs;
+ assert(_fd != INVALID_SOCKET);
+ if(read)
+ {
+ FD_SET(_fd, &_rFdSet);
+ }
+ else
+ {
+ FD_SET(_fd, &_wFdSet);
+ }
+
struct pollfd pollFd[1];
pollFd[0].fd = _fd;
pollFd[0].events = read ? POLLIN : POLLOUT;
rs = ::poll(pollFd, 1, timeout);
- if(rs == SOCKET_ERROR)
- {
- if(interrupted())
- {
- continue;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- if(rs == 0)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- return;
+ if(rs == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ continue;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ if(rs == 0)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ return;
#endif
}
}