本文整理汇总了C++中QSslSocket::sessionCipher方法的典型用法代码示例。如果您正苦于以下问题:C++ QSslSocket::sessionCipher方法的具体用法?C++ QSslSocket::sessionCipher怎么用?C++ QSslSocket::sessionCipher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSslSocket
的用法示例。
在下文中一共展示了QSslSocket::sessionCipher方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupSocket
void WebSocketWorker::SetupSocket()
{
if (m_connectionType == kSSLServer)
{
#ifndef QT_NO_OPENSSL
QSslSocket *pSslSocket = new QSslSocket();
if (pSslSocket->setSocketDescriptor(m_socketFD)
&& gCoreContext->CheckSubnet(pSslSocket))
{
pSslSocket->setSslConfiguration(m_sslConfig);
pSslSocket->startServerEncryption();
if (pSslSocket->waitForEncrypted(5000))
{
LOG(VB_HTTP, LOG_INFO, "SSL Handshake occurred, connection encrypted");
LOG(VB_HTTP, LOG_INFO, QString("Using %1 cipher").arg(pSslSocket->sessionCipher().name()));
}
else
{
LOG(VB_HTTP, LOG_WARNING, "SSL Handshake FAILED, connection terminated");
delete pSslSocket;
pSslSocket = nullptr;
}
}
else
{
delete pSslSocket;
pSslSocket = nullptr;
}
if (pSslSocket)
m_socket = dynamic_cast<QTcpSocket *>(pSslSocket);
else
return;
#else
return;
#endif
}
else // Plain old unencrypted socket
{
m_socket = new QTcpSocket();
m_socket->setSocketDescriptor(m_socketFD);
if (!gCoreContext->CheckSubnet(m_socket))
{
delete m_socket;
m_socket = nullptr;
return;
}
}
m_socket->setSocketOption(QAbstractSocket::KeepAliveOption, QVariant(1));
connect(m_socket, SIGNAL(readyRead()), SLOT(doRead()));
connect(m_socket, SIGNAL(disconnected()), SLOT(CloseConnection()));
// Setup heartbeat
m_heartBeat->setInterval(20000); // 20 second
m_heartBeat->setSingleShot(false);
connect(m_heartBeat, SIGNAL(timeout()), SLOT(SendHeartBeat()));
}