Skip to content

Commit

Permalink
ServerHandler: do not send pings unless the TLS handshake has completed.
Browse files Browse the repository at this point in the history
sss123next in #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.
  • Loading branch information
mkrautz committed Jan 13, 2018
1 parent 1844f21 commit d188861
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mumble/ServerHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d188861

Please sign in to comment.