void ChannelPoolChannel::registerTimeoutAndUpdateClockId( const bsls::TimeInterval& timeOut) { // This interface stinks: we have to guess a clockId that will not compete // with other clients of the channelpool! Instead, channelpool should // return us a unique clockId. We make an educated first guess (set to // 'channelId + 0x00800000' in the ctor so as not to conflict with the // handles used as clockId in the session pool) and increment it if it // happens to be a duplicate. With current usage in session pool, a single // iteration through the loop (i.e., no loop at all) should be guaranteed. // Note that the loop increments by 0x01000001 which is prime to 2^32, and // so it will run 2^32 times before it tries the same clockId. ReadQueue::iterator entryIter = d_readQueue.end(); --entryIter; bsl::function<void()> timeoutCallback(bdlf::BindUtil::bind( bdlf::MemFnUtil::memFn(&ChannelPoolChannel::timeoutCb, this), entryIter)); while (1 == d_channelPool_p->registerClock(timeoutCallback, timeOut, bsls::TimeInterval(0), ++d_nextClockId, d_channelId)) { d_nextClockId += 0x01000000; } }
void CertificateFetcherFromNetwork::doFetch(const shared_ptr<CertificateRequest>& certRequest, const shared_ptr<ValidationState>& state, const ValidationContinuation& continueValidation) { m_face.expressInterest(certRequest->interest, [=] (const Interest& interest, const Data& data) { dataCallback(data, certRequest, state, continueValidation); }, [=] (const Interest& interest, const lp::Nack& nack) { nackCallback(nack, certRequest, state, continueValidation); }, [=] (const Interest& interest) { timeoutCallback(certRequest, state, continueValidation); }); }
void CHttpController::StartTimeout() { TCallBack timeoutCallback( TimeoutEntry, this ); iTimeoutTimer->Cancel(); iTimeoutTimer->Start( KSecondInMilis * iTimeoutValue, 0, timeoutCallback ); }