本文整理汇总了C++中ConnectionIPtr::start方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionIPtr::start方法的具体用法?C++ ConnectionIPtr::start怎么用?C++ ConnectionIPtr::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionIPtr
的用法示例。
在下文中一共展示了ConnectionIPtr::start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConnectionI
void
IceInternal::IncomingConnectionFactory::initialize(const string& oaName)
{
if(_instance->defaultsAndOverrides()->overrideTimeout)
{
const_cast<EndpointIPtr&>(_endpoint) =
_endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
}
if(_instance->defaultsAndOverrides()->overrideCompress)
{
const_cast<EndpointIPtr&>(_endpoint) =
_endpoint->compress(_instance->defaultsAndOverrides()->overrideCompressValue);
}
try
{
const_cast<TransceiverPtr&>(_transceiver) = _endpoint->transceiver(const_cast<EndpointIPtr&>(_endpoint));
if(_transceiver)
{
ConnectionIPtr connection = new ConnectionI(_adapter->getCommunicator(), _instance, _reaper, _transceiver,
0, _endpoint, _adapter);
connection->start(0);
_connections.insert(connection);
}
else
{
const_cast<AcceptorPtr&>(_acceptor) = _endpoint->acceptor(const_cast<EndpointIPtr&>(_endpoint), oaName);
assert(_acceptor);
_acceptor->listen();
dynamic_cast<ObjectAdapterI*>(_adapter.get())->getThreadPool()->initialize(this);
}
}
catch(const Ice::Exception&)
{
if(_transceiver)
{
try
{
_transceiver->close();
}
catch(const Ice::LocalException&)
{
// Ignore
}
}
if(_acceptor)
{
try
{
_acceptor->close();
}
catch(const Ice::LocalException&)
{
// Ignore
}
}
_state = StateFinished;
_connections.clear();
throw;
}
}
示例2: if
void
IceInternal::IncomingConnectionFactory::message(ThreadPoolCurrent& current)
{
ConnectionIPtr connection;
ThreadPoolMessage<IncomingConnectionFactory> msg(current, *this);
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
ThreadPoolMessage<IncomingConnectionFactory>::IOScope io(msg);
if(!io)
{
return;
}
if(_state >= StateClosed)
{
return;
}
else if(_state == StateHolding)
{
IceUtil::ThreadControl::yield();
return;
}
//
// Reap closed connections
//
vector<Ice::ConnectionIPtr> cons;
_reaper->swapConnections(cons);
for(vector<Ice::ConnectionIPtr>::const_iterator p = cons.begin(); p != cons.end(); ++p)
{
_connections.erase(*p);
}
//
// Now accept a new connection.
//
TransceiverPtr transceiver;
try
{
transceiver = _acceptor->accept();
}
catch(const SocketException& ex)
{
if(noMoreFds(ex.error))
{
{
Error out(_instance->initializationData().logger);
out << "fatal error: can't accept more connections:\n" << ex << '\n' << _acceptor->toString();
}
abort();
}
// Ignore socket exceptions.
return;
}
catch(const LocalException& ex)
{
// Warn about other Ice local exceptions.
if(_warn)
{
Warning out(_instance->initializationData().logger);
out << "connection exception:\n" << ex << '\n' << _acceptor->toString();
}
return;
}
assert(transceiver);
try
{
connection = new ConnectionI(_adapter->getCommunicator(), _instance, _reaper, transceiver, 0, _endpoint,
_adapter);
}
catch(const LocalException& ex)
{
try
{
transceiver->close();
}
catch(const Ice::LocalException&)
{
// Ignore.
}
if(_warn)
{
Warning out(_instance->initializationData().logger);
out << "connection exception:\n" << ex << '\n' << _acceptor->toString();
}
return;
}
_connections.insert(connection);
}
assert(connection);
connection->start(this);
//.........这里部分代码省略.........