ServerHandler: do not send pings unless the TLS handshake has completed.

sss123next in mumble-voip/mumble#3294 reports that the current ping
timer logic causes problems with slow TLS handshakes, such as when
connecting to servers with large DH parameters.

This commit ensures pings are not sent before the TLS handshake has
completed.

This was tested against a Grumble instance built against a modified
crypto/tls package that sleeps during the handshake. I verified that
isEncrypted() returns false when the handshake has not finished, and
returns true when the handshake has completed.
This commit is contained in:
Mikkel Krautz 2018-01-13 21:53:05 +01:00
parent 1844f214e1
commit d1888619f4

View File

@ -461,6 +461,11 @@ void ServerHandler::sendPingInternal() {
return;
}
// Ensure the TLS handshake has completed before sending pings.
if (!qtsSock->isEncrypted()) {
return;
}
if (g.s.iMaxInFlightTCPPings >= 0 && iInFlightTCPPings >= g.s.iMaxInFlightTCPPings) {
serverConnectionClosed(QAbstractSocket::UnknownSocketError, tr("Server is not responding to TCP pings"));
return;