|
@@ -71,11 +71,6 @@ TlsTransport::TlsTransport(shared_ptr<TcpTransport> lower, string host, state_ca
|
|
gnutls_transport_set_pull_function(mSession, ReadCallback);
|
|
gnutls_transport_set_pull_function(mSession, ReadCallback);
|
|
gnutls_transport_set_pull_timeout_function(mSession, TimeoutCallback);
|
|
gnutls_transport_set_pull_timeout_function(mSession, TimeoutCallback);
|
|
|
|
|
|
- postCreation();
|
|
|
|
-
|
|
|
|
- mRecvThread = std::thread(&TlsTransport::runRecvLoop, this);
|
|
|
|
- registerIncoming();
|
|
|
|
-
|
|
|
|
} catch (...) {
|
|
} catch (...) {
|
|
gnutls_deinit(mSession);
|
|
gnutls_deinit(mSession);
|
|
gnutls_certificate_free_credentials(mCreds);
|
|
gnutls_certificate_free_credentials(mCreds);
|
|
@@ -90,6 +85,15 @@ TlsTransport::~TlsTransport() {
|
|
gnutls_certificate_free_credentials(mCreds);
|
|
gnutls_certificate_free_credentials(mCreds);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void TlsTransport::start() {
|
|
|
|
+ Transport::start();
|
|
|
|
+
|
|
|
|
+ registerIncoming();
|
|
|
|
+
|
|
|
|
+ PLOG_DEBUG << "Starting TLS recv thread";
|
|
|
|
+ mRecvThread = std::thread(&TlsTransport::runRecvLoop, this);
|
|
|
|
+}
|
|
|
|
+
|
|
bool TlsTransport::stop() {
|
|
bool TlsTransport::stop() {
|
|
if (!Transport::stop())
|
|
if (!Transport::stop())
|
|
return false;
|
|
return false;
|
|
@@ -124,10 +128,6 @@ void TlsTransport::incoming(message_ptr message) {
|
|
mIncomingQueue.stop();
|
|
mIncomingQueue.stop();
|
|
}
|
|
}
|
|
|
|
|
|
-void TlsTransport::postCreation() {
|
|
|
|
- // Dummy
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void TlsTransport::postHandshake() {
|
|
void TlsTransport::postHandshake() {
|
|
// Dummy
|
|
// Dummy
|
|
}
|
|
}
|
|
@@ -309,11 +309,6 @@ TlsTransport::TlsTransport(shared_ptr<TcpTransport> lower, string host, state_ca
|
|
SSL_set_options(mSsl, SSL_OP_SINGLE_ECDH_USE);
|
|
SSL_set_options(mSsl, SSL_OP_SINGLE_ECDH_USE);
|
|
SSL_set_tmp_ecdh(mSsl, ecdh.get());
|
|
SSL_set_tmp_ecdh(mSsl, ecdh.get());
|
|
|
|
|
|
- postCreation();
|
|
|
|
-
|
|
|
|
- mRecvThread = std::thread(&TlsTransport::runRecvLoop, this);
|
|
|
|
- registerIncoming();
|
|
|
|
-
|
|
|
|
} catch (...) {
|
|
} catch (...) {
|
|
if (mSsl)
|
|
if (mSsl)
|
|
SSL_free(mSsl);
|
|
SSL_free(mSsl);
|
|
@@ -330,6 +325,15 @@ TlsTransport::~TlsTransport() {
|
|
SSL_CTX_free(mCtx);
|
|
SSL_CTX_free(mCtx);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void TlsTransport::start() {
|
|
|
|
+ Transport::start();
|
|
|
|
+
|
|
|
|
+ registerIncoming();
|
|
|
|
+
|
|
|
|
+ PLOG_DEBUG << "Starting TLS recv thread";
|
|
|
|
+ mRecvThread = std::thread(&TlsTransport::runRecvLoop, this);
|
|
|
|
+}
|
|
|
|
+
|
|
bool TlsTransport::stop() {
|
|
bool TlsTransport::stop() {
|
|
if (!Transport::stop())
|
|
if (!Transport::stop())
|
|
return false;
|
|
return false;
|
|
@@ -369,10 +373,6 @@ void TlsTransport::incoming(message_ptr message) {
|
|
mIncomingQueue.stop();
|
|
mIncomingQueue.stop();
|
|
}
|
|
}
|
|
|
|
|
|
-void TlsTransport::postCreation() {
|
|
|
|
- // Dummy
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void TlsTransport::postHandshake() {
|
|
void TlsTransport::postHandshake() {
|
|
// Dummy
|
|
// Dummy
|
|
}
|
|
}
|