equal
deleted
inserted
replaced
294 #include "qsslsocket_openssl_p.h" |
294 #include "qsslsocket_openssl_p.h" |
295 #include "qsslconfiguration_p.h" |
295 #include "qsslconfiguration_p.h" |
296 |
296 |
297 #include <QtCore/qdebug.h> |
297 #include <QtCore/qdebug.h> |
298 #include <QtCore/qdir.h> |
298 #include <QtCore/qdir.h> |
299 #include <QtCore/qdatetime.h> |
|
300 #include <QtCore/qmutex.h> |
299 #include <QtCore/qmutex.h> |
|
300 #include <QtCore/qelapsedtimer.h> |
301 #include <QtNetwork/qhostaddress.h> |
301 #include <QtNetwork/qhostaddress.h> |
302 #include <QtNetwork/qhostinfo.h> |
302 #include <QtNetwork/qhostinfo.h> |
303 |
303 |
304 QT_BEGIN_NAMESPACE |
304 QT_BEGIN_NAMESPACE |
305 |
305 |
1401 if (!d->plainSocket || d->connectionEncrypted) |
1401 if (!d->plainSocket || d->connectionEncrypted) |
1402 return false; |
1402 return false; |
1403 if (d->mode == UnencryptedMode && !d->autoStartHandshake) |
1403 if (d->mode == UnencryptedMode && !d->autoStartHandshake) |
1404 return false; |
1404 return false; |
1405 |
1405 |
1406 QTime stopWatch; |
1406 QElapsedTimer stopWatch; |
1407 stopWatch.start(); |
1407 stopWatch.start(); |
1408 |
1408 |
1409 if (d->plainSocket->state() != QAbstractSocket::ConnectedState) { |
1409 if (d->plainSocket->state() != QAbstractSocket::ConnectedState) { |
1410 // Wait until we've entered connected state. |
1410 // Wait until we've entered connected state. |
1411 if (!d->plainSocket->waitForConnected(msecs)) |
1411 if (!d->plainSocket->waitForConnected(msecs)) |
1441 // (the inner waitForReadyRead() may fail, but the outer one still succeeded) |
1441 // (the inner waitForReadyRead() may fail, but the outer one still succeeded) |
1442 bool readyReadEmitted = false; |
1442 bool readyReadEmitted = false; |
1443 bool *previousReadyReadEmittedPointer = d->readyReadEmittedPointer; |
1443 bool *previousReadyReadEmittedPointer = d->readyReadEmittedPointer; |
1444 d->readyReadEmittedPointer = &readyReadEmitted; |
1444 d->readyReadEmittedPointer = &readyReadEmitted; |
1445 |
1445 |
1446 QTime stopWatch; |
1446 QElapsedTimer stopWatch; |
1447 stopWatch.start(); |
1447 stopWatch.start(); |
1448 |
1448 |
1449 if (!d->connectionEncrypted) { |
1449 if (!d->connectionEncrypted) { |
1450 // Wait until we've entered encrypted mode, or until a failure occurs. |
1450 // Wait until we've entered encrypted mode, or until a failure occurs. |
1451 if (!waitForEncrypted(msecs)) { |
1451 if (!waitForEncrypted(msecs)) { |
1478 if (!d->plainSocket) |
1478 if (!d->plainSocket) |
1479 return false; |
1479 return false; |
1480 if (d->mode == UnencryptedMode) |
1480 if (d->mode == UnencryptedMode) |
1481 return d->plainSocket->waitForBytesWritten(msecs); |
1481 return d->plainSocket->waitForBytesWritten(msecs); |
1482 |
1482 |
1483 QTime stopWatch; |
1483 QElapsedTimer stopWatch; |
1484 stopWatch.start(); |
1484 stopWatch.start(); |
1485 |
1485 |
1486 if (!d->connectionEncrypted) { |
1486 if (!d->connectionEncrypted) { |
1487 // Wait until we've entered encrypted mode, or until a failure occurs. |
1487 // Wait until we've entered encrypted mode, or until a failure occurs. |
1488 if (!waitForEncrypted(msecs)) |
1488 if (!waitForEncrypted(msecs)) |
1516 if (!d->plainSocket) |
1516 if (!d->plainSocket) |
1517 return false; |
1517 return false; |
1518 if (d->mode == UnencryptedMode) |
1518 if (d->mode == UnencryptedMode) |
1519 return d->plainSocket->waitForDisconnected(msecs); |
1519 return d->plainSocket->waitForDisconnected(msecs); |
1520 |
1520 |
1521 QTime stopWatch; |
1521 QElapsedTimer stopWatch; |
1522 stopWatch.start(); |
1522 stopWatch.start(); |
1523 |
1523 |
1524 if (!d->connectionEncrypted) { |
1524 if (!d->connectionEncrypted) { |
1525 // Wait until we've entered encrypted mode, or until a failure occurs. |
1525 // Wait until we've entered encrypted mode, or until a failure occurs. |
1526 if (!waitForEncrypted(msecs)) |
1526 if (!waitForEncrypted(msecs)) |