upgrade to QSslSocket
authoralfadur
Wed, 01 May 2019 00:29:46 +0300
changeset 14866 e088bd03812d
parent 14865 90cf07c60feb
child 14869 9078d787d491
upgrade to QSslSocket
QTfrontend/net/newnetclient.cpp
QTfrontend/net/newnetclient.h
--- a/QTfrontend/net/newnetclient.cpp	Wed May 01 00:01:56 2019 +0300
+++ b/QTfrontend/net/newnetclient.cpp	Wed May 01 00:29:46 2019 +0300
@@ -85,7 +85,18 @@
     netClientState = Connecting;
     mynick = nick;
     myhost = hostName + QString(":%1").arg(port);
-    NetSocket.connectToHost(hostName, port);
+    if (useTls)
+    {
+        NetSocket.connectToHostEncrypted(hostName, port);
+        if (!NetSocket.waitForEncrypted())
+        {
+            qWarning("Handshake failed");
+        }
+    }
+    else 
+    {
+        NetSocket.connectToHost(hostName, port);
+    }
 }
 
 void HWNewNet::Disconnect()
--- a/QTfrontend/net/newnetclient.h	Wed May 01 00:01:56 2019 +0300
+++ b/QTfrontend/net/newnetclient.h	Wed May 01 00:29:46 2019 +0300
@@ -22,7 +22,7 @@
 
 #include <QObject>
 #include <QString>
-#include <QTcpSocket>
+#include <QSslSocket>
 #include <QMap>
 
 #include "team.h"
@@ -69,7 +69,7 @@
         QString mynick;
         QString myroom;
         QString myhost;
-        QTcpSocket NetSocket;
+        QSslSocket NetSocket;
         QString seed;
         bool m_game_connected;
         bool m_nick_registered;