src/network/socket/qabstractsocket.cpp
changeset 30 5dc02b23752f
parent 23 89e065397ea6
child 37 758a864f9613
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   363 #include "qabstractsocket_p.h"
   363 #include "qabstractsocket_p.h"
   364 
   364 
   365 #include "private/qhostinfo_p.h"
   365 #include "private/qhostinfo_p.h"
   366 
   366 
   367 #include <qabstracteventdispatcher.h>
   367 #include <qabstracteventdispatcher.h>
   368 #include <qdatetime.h>
       
   369 #include <qhostaddress.h>
   368 #include <qhostaddress.h>
   370 #include <qhostinfo.h>
   369 #include <qhostinfo.h>
   371 #include <qmetaobject.h>
   370 #include <qmetaobject.h>
   372 #include <qpointer.h>
   371 #include <qpointer.h>
   373 #include <qtimer.h>
   372 #include <qtimer.h>
       
   373 #include <qelapsedtimer.h>
   374 
   374 
   375 #ifndef QT_NO_OPENSSL
   375 #ifndef QT_NO_OPENSSL
   376 #include <QtNetwork/qsslsocket.h>
   376 #include <QtNetwork/qsslsocket.h>
   377 #endif
   377 #endif
   378 
   378 
  1736         return socket->waitForConnected(msecs);
  1736         return socket->waitForConnected(msecs);
  1737 #endif
  1737 #endif
  1738 
  1738 
  1739     bool wasPendingClose = d->pendingClose;
  1739     bool wasPendingClose = d->pendingClose;
  1740     d->pendingClose = false;
  1740     d->pendingClose = false;
  1741     QTime stopWatch;
  1741     QElapsedTimer stopWatch;
  1742     stopWatch.start();
  1742     stopWatch.start();
  1743 
  1743 
  1744     if (d->state == HostLookupState) {
  1744     if (d->state == HostLookupState) {
  1745 #if defined (QABSTRACTSOCKET_DEBUG)
  1745 #if defined (QABSTRACTSOCKET_DEBUG)
  1746         qDebug("QAbstractSocket::waitForConnected(%i) doing host name lookup", msecs);
  1746         qDebug("QAbstractSocket::waitForConnected(%i) doing host name lookup", msecs);
  1817            this, so you cannot avoid this warning. */
  1817            this, so you cannot avoid this warning. */
  1818 //        qWarning("QAbstractSocket::waitForReadyRead() is not allowed in UnconnectedState");
  1818 //        qWarning("QAbstractSocket::waitForReadyRead() is not allowed in UnconnectedState");
  1819         return false;
  1819         return false;
  1820     }
  1820     }
  1821 
  1821 
  1822     QTime stopWatch;
  1822     QElapsedTimer stopWatch;
  1823     stopWatch.start();
  1823     stopWatch.start();
  1824 
  1824 
  1825     // handle a socket in connecting state
  1825     // handle a socket in connecting state
  1826     if (state() == HostLookupState || state() == ConnectingState) {
  1826     if (state() == HostLookupState || state() == ConnectingState) {
  1827         if (!waitForConnected(msecs))
  1827         if (!waitForConnected(msecs))
  1876     }
  1876     }
  1877 
  1877 
  1878     if (d->writeBuffer.isEmpty())
  1878     if (d->writeBuffer.isEmpty())
  1879         return false;
  1879         return false;
  1880 
  1880 
  1881     QTime stopWatch;
  1881     QElapsedTimer stopWatch;
  1882     stopWatch.start();
  1882     stopWatch.start();
  1883 
  1883 
  1884     // handle a socket in connecting state
  1884     // handle a socket in connecting state
  1885     if (state() == HostLookupState || state() == ConnectingState) {
  1885     if (state() == HostLookupState || state() == ConnectingState) {
  1886         if (!waitForConnected(msecs))
  1886         if (!waitForConnected(msecs))
  1958     if (state() == UnconnectedState) {
  1958     if (state() == UnconnectedState) {
  1959         qWarning("QAbstractSocket::waitForDisconnected() is not allowed in UnconnectedState");
  1959         qWarning("QAbstractSocket::waitForDisconnected() is not allowed in UnconnectedState");
  1960         return false;
  1960         return false;
  1961     }
  1961     }
  1962 
  1962 
  1963     QTime stopWatch;
  1963     QElapsedTimer stopWatch;
  1964     stopWatch.start();
  1964     stopWatch.start();
  1965 
  1965 
  1966     // handle a socket in connecting state
  1966     // handle a socket in connecting state
  1967     if (state() == HostLookupState || state() == ConnectingState) {
  1967     if (state() == HostLookupState || state() == ConnectingState) {
  1968         if (!waitForConnected(msecs))
  1968         if (!waitForConnected(msecs))