diff options
Diffstat (limited to 'client/SslClient.cpp')
-rw-r--r-- | client/SslClient.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/client/SslClient.cpp b/client/SslClient.cpp index b1841ed..c087c40 100644 --- a/client/SslClient.cpp +++ b/client/SslClient.cpp @@ -4,6 +4,8 @@ #include <QtNetwork> #include "SslClient.h" +QSslSocket SslClient::sslSocket; + SslClient::SslClient(): port(13666) { SslClient(QString("127.0.0.1")); @@ -35,7 +37,6 @@ SslClient::SslClient(QString addr): port(13666) cert_file.close(); /* create ssl socket */ - //sslSocket = new QSslSocket; sslSocket.setLocalCertificate(cert); sslSocket.setPrivateKey(key); sslSocket.setCaCertificates(ca_certs); @@ -73,8 +74,11 @@ void SslClient::SendRequest(RequestType type) if (sslSocket.state() != QAbstractSocket::ConnectedState) { Logger::Trace("Connecting to server %s:%u\n", server.toLocal8Bit().data(), port); - //sslSocket.connectToHostEncrypted(server, port); - sslSocket.connectToHostEncrypted("127.0.0.1", port); + sslSocket.connectToHostEncrypted(server, port); + while (! sslSocket.waitForConnected(5000)) + { + Logger::Trace("Waiting for connection to be established...\n"); + } } else { @@ -109,6 +113,10 @@ void SslClient::SendFileRequest(string filename) { Logger::Trace("Connecting to server %s:%u\n", server.toLocal8Bit().data(), port); sslSocket.connectToHostEncrypted(server, port); + while (! sslSocket.waitForConnected(5000)) + { + Logger::Trace("Waiting for connection to be established...\n"); + } } else { @@ -125,7 +133,7 @@ void SslClient::SendFileRequest(string filename) data[path_len - 1] = data[path_len - 2] = 0x14; QByteArray pkt(data); - sslSocket.write(pkt); + sslSocket.write(pkt); } |