本文整理汇总了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;
}
示例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;
}