summaryrefslogtreecommitdiff
path: root/media-sound/mumble/files/pinger_fix.patch
blob: a701100d7a02528cf06420e4d121791ad41af910 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp
index 7e30e76a..d02ad0c1 100644
--- a/src/mumble/ServerHandler.cpp
+++ b/src/mumble/ServerHandler.cpp
@@ -349,10 +349,9 @@ void ServerHandler::run() {
 
 		tTimestamp.restart();
 
-		// Setup ping timer;
-		QTimer *ticker = new QTimer(this);
-		connect(ticker, SIGNAL(timeout()), this, SLOT(sendPing()));
-		ticker->start(5000);
+		ping_ticker = new QTimer(this);
+		connect(ping_ticker, SIGNAL(timeout()), this, SLOT(sendPing()));
+
 
 		g.mw->rtLast = MumbleProto::Reject_RejectType_None;
 
@@ -370,6 +369,8 @@ void ServerHandler::run() {
 			shouldTryNextTargetServer = false;
 		}
 
+		ping_ticker->stop();
+
 		if (qusUdp) {
 			QMutexLocker qml(&qmUdp);
 
@@ -384,7 +385,6 @@ void ServerHandler::run() {
 			qusUdp = NULL;
 		}
 
-		ticker->stop();
 
 		ConnectionPtr cptr(cConnection);
 		if (cptr) {
@@ -619,7 +619,7 @@ void ServerHandler::serverConnectionStateChanged(QAbstractSocket::SocketState st
 		tConnectionTimeoutTimer = new QTimer();
 		connect(tConnectionTimeoutTimer, SIGNAL(timeout()), this, SLOT(serverConnectionTimeoutOnConnect()));
 		tConnectionTimeoutTimer->setSingleShot(true);
-		tConnectionTimeoutTimer->start(30000);
+		tConnectionTimeoutTimer->start(120000); //this may take some time on server with large dh
 	} else if (state == QAbstractSocket::ConnectedState) {
 		// Start TLS handshake
 		qtsSock->startClientEncryption();
@@ -651,6 +651,11 @@ void ServerHandler::serverConnectionConnected() {
 		return;
 	}
 
+	// Setup ping timer;
+	//do this after succesfull connection, not before
+	ping_ticker->start(10000); //do not waste too much traffic here, 10 seconds instead of 5 is ok
+
+
 	MumbleProto::Version mpv;
 	mpv.set_release(u8(QLatin1String(MUMBLE_RELEASE)));
 
diff --git a/src/mumble/ServerHandler.h b/src/mumble/ServerHandler.h
index bb558c4b..130e65aa 100644
--- a/src/mumble/ServerHandler.h
+++ b/src/mumble/ServerHandler.h
@@ -77,7 +77,7 @@ class ServerHandler : public QThread {
 	public:
 		Timer tTimestamp;
 		int iInFlightTCPPings;
-		QTimer *tConnectionTimeoutTimer;
+		QTimer *tConnectionTimeoutTimer, *ping_ticker;
 		QList<QSslError> qlErrors;
 		QList<QSslCertificate> qscCert;
 		QSslCipher qscCipher;