OpenSSL v1.1.1: fix qtbug18498_peek

Previously the test worked because the client was the last party to know
when encryption was established. However, due to changes in the TLSv1.3
handshake the server is now the last one.

In either case, relying on both to be encrypted when one of them is
finished is not great, so now we only quit the event loop when both
client and server have emitted 'encrypted'.

Change-Id: Ic1fc75671206d866f7ea983805fd58a99657aac6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
Mårten Nordheim 2018-05-09 12:50:59 +02:00
parent 68e6d64fe3
commit 5134ff882a
1 changed files with 10 additions and 2 deletions

View File

@ -2838,11 +2838,19 @@ void tst_QSslSocket::qtbug18498_peek()
client->setObjectName("client");
client->ignoreSslErrors();
connect(client, SIGNAL(encrypted()), this, SLOT(exitLoop()));
int encryptedCounter = 2;
connect(client, &QSslSocket::encrypted, this, [&encryptedCounter, this](){
if (!--encryptedCounter)
exitLoop();
});
WebSocket *serversocket = server.socket;
connect(serversocket, &QSslSocket::encrypted, this, [&encryptedCounter, this](){
if (!--encryptedCounter)
exitLoop();
});
connect(client, SIGNAL(disconnected()), this, SLOT(exitLoop()));
client->startClientEncryption();
WebSocket *serversocket = server.socket;
QVERIFY(serversocket);
serversocket->setObjectName("server");