Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/network/socket/qabstractsocket.cpp

    r651 r769  
    156156    examples for an overview of both approaches.
    157157
     158    \note We discourage the use of the blocking functions together
     159    with signals. One of the two possibilities should be used.
     160
    158161    QAbstractSocket can be used with QTextStream and QDataStream's
    159162    stream operators (operator<<() and operator>>()). There is one
     
    170173    the host lookup has succeeded.
    171174
     175    \note Since Qt 4.6.3 QAbstractSocket may emit hostFound()
     176    directly from the connectToHost() call since a DNS result could have been
     177    cached.
     178
    172179    \sa connected()
    173180*/
     
    178185    This signal is emitted after connectToHost() has been called and
    179186    a connection has been successfully established.
     187
     188    \note On some operating systems the connected() signal may
     189    be directly emitted from the connectToHost() call for connections
     190    to the localhost.
    180191
    181192    \sa connectToHost(), disconnected()
     
    352363#include "qabstractsocket_p.h"
    353364
     365#include "private/qhostinfo_p.h"
     366
    354367#include <qabstracteventdispatcher.h>
    355368#include <qdatetime.h>
     
    13671380#endif
    13681381    } else {
    1369         if (d->threadData->eventDispatcher)
    1370             d->hostLookupId = QHostInfo::lookupHost(hostName, this, SLOT(_q_startConnecting(QHostInfo)));
     1382        if (d->threadData->eventDispatcher) {
     1383            // this internal API for QHostInfo either immediatly gives us the desired
     1384            // QHostInfo from cache or later calls the _q_startConnecting slot.
     1385            bool immediateResultValid = false;
     1386            QHostInfo hostInfo = qt_qhostinfo_lookup(hostName,
     1387                                                     this,
     1388                                                     SLOT(_q_startConnecting(QHostInfo)),
     1389                                                     &immediateResultValid,
     1390                                                     &d->hostLookupId);
     1391            if (immediateResultValid) {
     1392                d->hostLookupId = -1;
     1393                d->_q_startConnecting(hostInfo);
     1394            }
     1395        }
    13711396    }
    13721397
     
    16831708    If msecs is -1, this function will not time out.
    16841709
    1685     Note: This function may wait slightly longer than \a msecs,
     1710    \note This function may wait slightly longer than \a msecs,
    16861711    depending on the time it takes to complete the host lookup.
     1712
     1713    \note Multiple calls to this functions do not accumulate the time.
     1714    If the function times out, the connecting process will be aborted.
    16871715
    16881716    \sa connectToHost(), connected()
     
    17231751    }
    17241752    if (state() == UnconnectedState)
    1725         return false;
     1753        return false; // connect not im progress anymore!
    17261754
    17271755    bool timedOut = true;
     
    23552383        qDebug("QAbstractSocket::disconnectFromHost() aborting immediately");
    23562384#endif
     2385        if (d->state == HostLookupState) {
     2386            QHostInfo::abortHostLookup(d->hostLookupId);
     2387            d->hostLookupId = -1;
     2388        }
    23572389    } else {
    23582390        // Perhaps emit closing()
Note: See TracChangeset for help on using the changeset viewer.