当前位置: 首页>>代码示例>>C++>>正文


C++ Ticket::expiration方法代码示例

本文整理汇总了C++中Ticket::expiration方法的典型用法代码示例。如果您正苦于以下问题:C++ Ticket::expiration方法的具体用法?C++ Ticket::expiration怎么用?C++ Ticket::expiration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ticket的用法示例。


在下文中一共展示了Ticket::expiration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _runTicket

Status TransportLayerLegacy::_runTicket(Ticket ticket) {
    if (!_running.load()) {
        return TransportLayer::ShutdownStatus;
    }

    if (ticket.expiration() < Date_t::now()) {
        return Ticket::ExpiredStatus;
    }

    AbstractMessagingPort* amp;

    {
        stdx::lock_guard<stdx::mutex> lk(_connectionsMutex);

        auto conn = _connections.find(ticket.sessionId());
        if (conn == _connections.end()) {
            return TransportLayer::TicketSessionUnknownStatus;
        }

        // "check out" the port
        conn->second.inUse = true;
        amp = conn->second.amp.get();
    }

    auto legacyTicket = checked_cast<LegacyTicket*>(getTicketImpl(ticket));
    auto res = legacyTicket->_fill(amp);

    {
        stdx::lock_guard<stdx::mutex> lk(_connectionsMutex);

        auto conn = _connections.find(ticket.sessionId());
        invariant(conn != _connections.end());

#ifdef MONGO_CONFIG_SSL
        // If we didn't have an X509 subject name, see if we have one now
        if (!conn->second.sslPeerInfo) {
            auto info = amp->getX509PeerInfo();
            if (info.subjectName != "") {
                conn->second.sslPeerInfo = info;
            }
        }
#endif
        conn->second.inUse = false;

        if (conn->second.ended) {
            Listener::globalTicketHolder.release();
            _connections.erase(conn);
        }
    }

    return res;
}
开发者ID:mihail812,项目名称:mongo,代码行数:52,代码来源:transport_layer_legacy.cpp

示例2: _runTicket

Status TransportLayerLegacy::_runTicket(Ticket ticket) {
    if (!_running.load()) {
        return TransportLayer::ShutdownStatus;
    }

    if (ticket.expiration() < Date_t::now()) {
        return Ticket::ExpiredStatus;
    }

    // get the weak_ptr out of the ticket
    // attempt to make it into a shared_ptr
    auto legacyTicket = checked_cast<LegacyTicket*>(getTicketImpl(ticket));
    auto session = legacyTicket->getSession();
    if (!session) {
        return TransportLayer::TicketSessionClosedStatus;
    }

    auto conn = session->conn();
    if (conn->closed) {
        return TransportLayer::TicketSessionClosedStatus;
    }

    Status res = Status::OK();
    try {
        res = legacyTicket->fill(conn->amp.get());
    } catch (...) {
        res = exceptionToStatus();
    }

#ifdef MONGO_CONFIG_SSL
    // If we didn't have an X509 subject name, see if we have one now
    auto& sslPeerInfo = SSLPeerInfo::forSession(legacyTicket->getSession());
    if (sslPeerInfo.subjectName.empty()) {
        auto info = conn->amp->getX509PeerInfo();
        if (!info.subjectName.empty()) {
            sslPeerInfo = info;
        }
    }
#endif

    return res;
}
开发者ID:DINKIN,项目名称:mongo,代码行数:42,代码来源:transport_layer_legacy.cpp


注:本文中的Ticket::expiration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。