Subject: [PATCH 1/1] sshmasterconnection.cpp: invalid proxy socket
From: Heinrich Schuchardt <[email-masked]>
To: [email-masked]
Cc: Stefan Baur <[email-masked]>, Mihai Moldovan <[email-masked]>, Orion Poplawski <[email-masked]>, Heinrich Schuchardt <[email-masked]>
Date: Mon, 22 Feb 2016 00:08:28 +0100

Package: x2goclient
Version: 4.0.5.1

x2goclient shows proxy socket -1 (invalid).

http://doc.qt.io/qt-4.8/qabstractsocket.html#socketDescriptor:
The socket descriptor is not available when QAbstractSocket is in
UnconnectedState.

So we have first to connect to the proxy server before retrieving the
native socket.

Signed-off-by: Heinrich Schuchardt <[email-masked]>
---
 src/sshmasterconnection.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp
index 5b3cff5..bb69047 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -548,7 +548,6 @@ void SshMasterConnection::run()
         tcpProxySocket = new QTcpSocket();
         tcpProxySocket->setProxy( *tcpNetworkProxy );
         tcpProxySocket->connectToHost(host, port);
-        proxysocket = tcpProxySocket->socketDescriptor();
         if (!tcpProxySocket->waitForConnected(30000))
         {
             QString message=tr ( "Cannot connect to proxy server." );
@@ -560,6 +559,7 @@ void SshMasterConnection::run()
             quit();
             return;
         }
+        proxysocket = tcpProxySocket->socketDescriptor();
 #ifdef DEBUG
         x2goDebug << "Created HTTP proxy socket: " << proxysocket << endl;
 #endif
-- 
2.1.4