Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    366366
    367367#include <qabstracteventdispatcher.h>
    368 #include <qdatetime.h>
    369368#include <qhostaddress.h>
    370369#include <qhostinfo.h>
     
    372371#include <qpointer.h>
    373372#include <qtimer.h>
     373#include <qelapsedtimer.h>
    374374
    375375#ifndef QT_NO_OPENSSL
     
    12131213}
    12141214
     1215
     1216void QAbstractSocketPrivate::pauseSocketNotifiers(QAbstractSocket *socket)
     1217{
     1218    QAbstractSocketEngine *socketEngine = socket->d_func()->socketEngine;
     1219    if (!socketEngine)
     1220        return;
     1221    socket->d_func()->prePauseReadSocketNotifierState = socketEngine->isReadNotificationEnabled();
     1222    socket->d_func()->prePauseWriteSocketNotifierState = socketEngine->isWriteNotificationEnabled();
     1223    socket->d_func()->prePauseExceptionSocketNotifierState = socketEngine->isExceptionNotificationEnabled();
     1224    socketEngine->setReadNotificationEnabled(false);
     1225    socketEngine->setWriteNotificationEnabled(false);
     1226    socketEngine->setExceptionNotificationEnabled(false);
     1227}
     1228
     1229void QAbstractSocketPrivate::resumeSocketNotifiers(QAbstractSocket *socket)
     1230{
     1231    QAbstractSocketEngine *socketEngine = socket->d_func()->socketEngine;
     1232    if (!socketEngine)
     1233        return;
     1234    socketEngine->setReadNotificationEnabled(socket->d_func()->prePauseReadSocketNotifierState);
     1235    socketEngine->setWriteNotificationEnabled(socket->d_func()->prePauseWriteSocketNotifierState);
     1236    socketEngine->setExceptionNotificationEnabled(socket->d_func()->prePauseExceptionSocketNotifierState);
     1237}
     1238
     1239QAbstractSocketEngine* QAbstractSocketPrivate::getSocketEngine(QAbstractSocket *socket)
     1240{
     1241    return socket->d_func()->socketEngine;
     1242}
     1243
     1244
    12151245/*! \internal
    12161246
     
    13811411    } else {
    13821412        if (d->threadData->eventDispatcher) {
    1383             // this internal API for QHostInfo either immediatly gives us the desired
     1413            // this internal API for QHostInfo either immediately gives us the desired
    13841414            // QHostInfo from cache or later calls the _q_startConnecting slot.
    13851415            bool immediateResultValid = false;
     
    17391769    bool wasPendingClose = d->pendingClose;
    17401770    d->pendingClose = false;
    1741     QTime stopWatch;
     1771    QElapsedTimer stopWatch;
    17421772    stopWatch.start();
    17431773
     
    18201850    }
    18211851
    1822     QTime stopWatch;
     1852    QElapsedTimer stopWatch;
    18231853    stopWatch.start();
    18241854
     
    18791909        return false;
    18801910
    1881     QTime stopWatch;
     1911    QElapsedTimer stopWatch;
    18821912    stopWatch.start();
    18831913
     
    19611991    }
    19621992
    1963     QTime stopWatch;
     1993    QElapsedTimer stopWatch;
    19641994    stopWatch.start();
    19651995
  • trunk/src/network/socket/qabstractsocket.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qabstractsocket_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    159159
    160160    QAbstractSocket::SocketError socketError;
     161
     162    bool prePauseReadSocketNotifierState;
     163    bool prePauseWriteSocketNotifierState;
     164    bool prePauseExceptionSocketNotifierState;
     165    static void pauseSocketNotifiers(QAbstractSocket*);
     166    static void resumeSocketNotifiers(QAbstractSocket*);
     167    static QAbstractSocketEngine* getSocketEngine(QAbstractSocket*);
    161168};
    162169
  • trunk/src/network/socket/qabstractsocketengine.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qabstractsocketengine_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qhttpsocketengine.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4343#include "qtcpsocket.h"
    4444#include "qhostaddress.h"
    45 #include "qdatetime.h"
    4645#include "qurl.h"
    4746#include "qhttp.h"
     47#include "qelapsedtimer.h"
    4848
    4949#if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP)
     
    320320        return false;
    321321
    322     QTime stopWatch;
     322    QElapsedTimer stopWatch;
    323323    stopWatch.start();
    324324
     
    367367    }
    368368
    369     QTime stopWatch;
     369    QElapsedTimer stopWatch;
    370370    stopWatch.start();
    371371
  • trunk/src/network/socket/qhttpsocketengine_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qlocalserver.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qlocalserver.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qlocalserver_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    100100        HANDLE handle;
    101101        OVERLAPPED overlapped;
     102        bool connected;
    102103    };
    103104
  • trunk/src/network/socket/qlocalserver_tcp.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qlocalserver_unix.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    120120    //
    121121    // This change can be removed once more generic fix to select thread
    122     // syncronization problem is implemented.
     122    // synchronization problem is implemented.
    123123    int flags = fcntl(listenSocket, F_GETFL, 0);
    124124    if (-1 == flags
  • trunk/src/network/socket/qlocalserver_win.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6666                 (const wchar_t *)fullServerName.utf16(), // pipe name
    6767                 PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,       // read/write access
    68                  PIPE_TYPE_MESSAGE |       // message type pipe
    69                  PIPE_READMODE_MESSAGE |   // message-read mode
     68                 PIPE_TYPE_BYTE |          // byte type pipe
     69                 PIPE_READMODE_BYTE |      // byte-read mode
    7070                 PIPE_WAIT,                // blocking mode
    7171                 PIPE_UNLIMITED_INSTANCES, // max. instances
     
    8686        switch (GetLastError()) {
    8787        case ERROR_IO_PENDING:
     88            listener.connected = false;
    8889            break;
    8990        case ERROR_PIPE_CONNECTED:
     91            listener.connected = true;
    9092            SetEvent(eventHandle);
    9193            break;
     
    156158    for (int i = 0; i < listeners.size(); ) {
    157159        HANDLE handle = listeners[i].handle;
    158         if (GetOverlappedResult(handle, &listeners[i].overlapped, &dummy, FALSE)) {
     160        if (listeners[i].connected
     161            || GetOverlappedResult(handle, &listeners[i].overlapped, &dummy, FALSE))
     162        {
    159163            listeners.removeAt(i);
    160164
  • trunk/src/network/socket/qlocalsocket.cpp

    r755 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qlocalsocket.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qlocalsocket_p.h

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    136136    void _q_pipeClosed();
    137137    void _q_emitReadyRead();
    138     DWORD bytesAvailable();
     138    DWORD checkPipeState();
    139139    void startAsyncRead();
    140140    bool completeAsyncRead();
  • trunk/src/network/socket/qlocalsocket_tcp.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qlocalsocket_unix.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5353#include <errno.h>
    5454
    55 #include <qdatetime.h>
    5655#include <qdir.h>
    5756#include <qdebug.h>
     57#include <qelapsedtimer.h>
    5858
    5959#ifdef Q_OS_VXWORKS
     
    535535    int result = -1;
    536536    // on Linux timeout will be updated by select, but _not_ on other systems.
    537     QTime timer;
     537    QElapsedTimer timer;
    538538    timer.start();
    539539    while (state() == ConnectingState
  • trunk/src/network/socket/qlocalsocket_win.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    193193    Q_D(QLocalSocket);
    194194
     195    if (d->pipeClosed && d->actualReadBufferSize == 0)
     196        return -1;  // signal EOF
     197
    195198    qint64 readSoFar;
    196199    // If startAsyncRead() read data, copy it to its destination.
     
    214217
    215218    if (d->pipeClosed) {
    216         if (readSoFar == 0) {
     219        if (d->actualReadBufferSize == 0)
    217220            QTimer::singleShot(0, this, SLOT(_q_pipeClosed()));
    218             return -1;  // signal EOF
    219         }
    220221    } else {
    221222        if (!d->readSequenceStarted)
     
    251252{
    252253    do {
    253         DWORD bytesToRead = bytesAvailable();
     254        DWORD bytesToRead = checkPipeState();
     255        if (pipeClosed)
     256            return;
     257
    254258        if (bytesToRead == 0) {
    255259            // There are no bytes in the pipe but we need to
     
    277281                    // This is not an error. We're getting notified, when data arrives.
    278282                    return;
     283                case ERROR_MORE_DATA:
     284                    // This is not an error. The synchronous read succeeded.
     285                    // We're connected to a message mode pipe and the message
     286                    // didn't fit into the pipe's system buffer.
     287                    completeAsyncRead();
     288                    break;
    279289                case ERROR_PIPE_NOT_CONNECTED:
    280290                    {
     
    297307    \internal
    298308    Sets the correct size of the read buffer after a read operation.
    299     Returns false, if an error occured or the connection dropped.
     309    Returns false, if an error occurred or the connection dropped.
    300310 */
    301311bool QLocalSocketPrivate::completeAsyncRead()
     
    306316    DWORD bytesRead;
    307317    if (!GetOverlappedResult(handle, &overlapped, &bytesRead, TRUE)) {
    308         if (GetLastError() != ERROR_PIPE_NOT_CONNECTED)
     318        switch (GetLastError()) {
     319        case ERROR_MORE_DATA:
     320            // This is not an error. We're connected to a message mode
     321            // pipe and the message didn't fit into the pipe's system
     322            // buffer. We will read the remaining data in the next call.
     323            break;
     324        case ERROR_PIPE_NOT_CONNECTED:
     325            return false;
     326        default:
    309327            setErrorString(QLatin1String("QLocalSocketPrivate::completeAsyncRead"));
    310         return false;
     328            return false;
     329        }
    311330    }
    312331
     
    334353
    335354/*!
    336     The number of bytes available from the pipe
    337   */
    338 DWORD QLocalSocketPrivate::bytesAvailable()
     355    \internal
     356    Returns the number of available bytes in the pipe.
     357    Sets QLocalSocketPrivate::pipeClosed to true if the connection is broken.
     358 */
     359DWORD QLocalSocketPrivate::checkPipeState()
    339360{
    340361    Q_Q(QLocalSocket);
     
    346367            pipeClosed = true;
    347368            emit q->readChannelFinished();
    348             QTimer::singleShot(0, q, SLOT(_q_pipeClosed()));
     369            if (actualReadBufferSize == 0)
     370                QTimer::singleShot(0, q, SLOT(_q_pipeClosed()));
    349371        }
    350372    }
     
    479501        pipeClosed = true;
    480502        emit q->readChannelFinished();
     503        if (actualReadBufferSize == 0)
     504            QTimer::singleShot(0, q, SLOT(_q_pipeClosed()));
    481505        return;
    482506    }
     
    530554    QIncrementalSleepTimer timer(msecs);
    531555    forever {
    532         d->bytesAvailable();    // to check if PeekNamedPipe fails
     556        d->checkPipeState();
    533557        if (d->pipeClosed)
    534558            close();
     
    562586        return false;
    563587
     588    // We already know that the pipe is gone, but did not enter the event loop yet.
     589    if (d->pipeClosed) {
     590        close();
     591        return false;
     592    }
     593
    564594    Q_ASSERT(d->readSequenceStarted);
    565595    DWORD result = WaitForSingleObject(d->overlapped.hEvent, msecs == -1 ? INFINITE : msecs);
     
    567597        case WAIT_OBJECT_0:
    568598            d->_q_notified();
     599            // We just noticed that the pipe is gone.
     600            if (d->pipeClosed) {
     601                close();
     602                return false;
     603            }
    569604            return true;
    570605        case WAIT_TIMEOUT:
  • trunk/src/network/socket/qnativesocketengine.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    186186        // one exception: SocketError(11) bypasses this as it's purely
    187187        // a temporary internal error condition.
     188        // Another exception is the way the waitFor*() functions set
     189        // an error when a timeout occurs. After the call to setError()
     190        // they reset the hasSetSocketError to false
    188191        return;
    189192    }
     
    860863        d->setError(QAbstractSocket::SocketTimeoutError,
    861864            QNativeSocketEnginePrivate::TimeOutErrorString);
     865        d->hasSetSocketError = false; // A timeout error is temporary in waitFor functions
    862866        return false;
    863867    } else if (state() == QAbstractSocket::ConnectingState) {
     
    928932        d->setError(QAbstractSocket::SocketTimeoutError,
    929933                    QNativeSocketEnginePrivate::TimeOutErrorString);
     934        d->hasSetSocketError = false; // A timeout error is temporary in waitFor functions
    930935        return false;
    931936    } else if (state() == QAbstractSocket::ConnectingState) {
     
    979984        d->setError(QAbstractSocket::SocketTimeoutError,
    980985                    QNativeSocketEnginePrivate::TimeOutErrorString);
     986        d->hasSetSocketError = false; // A timeout error is temporary in waitFor functions
    981987        return false;
    982988    } else if (state() == QAbstractSocket::ConnectingState) {
  • trunk/src/network/socket/qnativesocketengine_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qnativesocketengine_unix.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4545#include "qiodevice.h"
    4646#include "qhostaddress.h"
     47#include "qelapsedtimer.h"
    4748#include "qvarlengtharray.h"
    48 #include "qdatetime.h"
    4949#include <time.h>
    5050#include <errno.h>
     
    203203    }
    204204
    205     // Ensure that the socket is closed on exec*().
    206     ::fcntl(socket, F_SETFD, FD_CLOEXEC);
    207 
    208205    socketDescriptor = socket;
    209206    return true;
     
    353350        sockAddrIPv6.sin6_family = AF_INET6;
    354351        sockAddrIPv6.sin6_port = htons(port);
     352
     353        QString scopeid = addr.scopeId();
     354        bool ok;
     355        sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
    355356#ifndef QT_NO_IPV6IFNAME
    356         sockAddrIPv6.sin6_scope_id = ::if_nametoindex(addr.scopeId().toLatin1().data());
    357 #else
    358         sockAddrIPv6.sin6_scope_id = addr.scopeId().toInt();
     357        if (!ok)
     358            sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.toLatin1());
    359359#endif
    360360        Q_IPV6ADDR ip6 = addr.toIPv6Address();
     
    426426        case EFAULT:
    427427        case ENOTSOCK:
     428#ifdef Q_OS_SYMBIAN
     429        case EPIPE:
     430#endif
    428431            socketState = QAbstractSocket::UnconnectedState;
    429432        default:
     
    559562#else
    560563    int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0);
    561 #endif
    562     //check if we have vaild descriptor at all
    563     if(acceptedDescriptor > 0) {
    564         // Ensure that the socket is closed on exec*()
    565         ::fcntl(acceptedDescriptor, F_SETFD, FD_CLOEXEC);
    566     }
    567 #ifdef Q_OS_SYMBIAN
    568     else {
    569         qWarning("QNativeSocketEnginePrivate::nativeAccept() - acceptedDescriptor <= 0");
    570     }
    571564#endif
    572565
     
    10091002    ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv);
    10101003#else
    1011     QTime timer;
     1004    QElapsedTimer timer;
    10121005    timer.start();
    10131006
  • trunk/src/network/socket/qnativesocketengine_win.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    208208        memset(sockAddrIPv6, 0, sizeof(qt_sockaddr_in6));
    209209        sockAddrIPv6->sin6_family = AF_INET6;
     210        sockAddrIPv6->sin6_scope_id = address.scopeId().toInt();
    210211        WSAHtons(socketDescriptor, port, &(sockAddrIPv6->sin6_port));
    211212        Q_IPV6ADDR tmp = address.toIPv6Address();
     
    733734    int acceptedDescriptor = WSAAccept(socketDescriptor, 0,0,0,0);
    734735        if (acceptedDescriptor != -1 && QAbstractEventDispatcher::instance()) {
    735                 // Becuase of WSAAsyncSelect() WSAAccept returns a non blocking socket
     736                // Because of WSAAsyncSelect() WSAAccept returns a non blocking socket
    736737                // with the same attributes as the listening socket including the current
    737738                // WSAAsyncSelect(). To be able to change the socket to blocking mode the
  • trunk/src/network/socket/qnet_unix_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qsocks5socketengine.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5050#include "qhash.h"
    5151#include "qqueue.h"
    52 #include "qdatetime.h"
     52#include "qelapsedtimer.h"
    5353#include "qmutex.h"
    5454#include "qthread.h"
     
    309309    QHostAddress peerAddress;
    310310    quint16 peerPort;
    311     QDateTime timeStamp;
     311    QElapsedTimer timeStamp;
    312312};
    313313
     
    370370        // qDebug() << "delete it";
    371371    }
    372     bindData->timeStamp = QDateTime::currentDateTime();
     372    bindData->timeStamp.start();
    373373    store.insert(socketDescriptor, bindData);
    374374    // start sweep timer if not started
     
    413413        while (it.hasNext()) {
    414414            it.next();
    415             if (it.value()->timeStamp.secsTo(QDateTime::currentDateTime()) > 350) {
     415            if (it.value()->timeStamp.hasExpired(350000)) {
    416416                QSOCKS5_DEBUG << "QSocks5BindStore removing JJJJ";
    417417                it.remove();
     
    13561356
    13571357    int msecs = SOCKS5_BLOCKING_BIND_TIMEOUT;
    1358     QTime stopWatch;
     1358    QElapsedTimer stopWatch;
    13591359    stopWatch.start();
    13601360    d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port());
     
    14561456        if (d->data->controlSocket->state() == QAbstractSocket::ConnectedState) {
    14571457            int msecs = 100;
    1458             QTime stopWatch;
     1458            QElapsedTimer stopWatch;
    14591459            stopWatch.start();
    14601460            while (!d->data->controlSocket->bytesToWrite()) {
     
    16751675        UdpAssociateSuccess;
    16761676
    1677     QTime stopWatch;
     1677    QElapsedTimer stopWatch;
    16781678    stopWatch.start();
    16791679
     
    17001700    d->readNotificationActivated = false;
    17011701
    1702     QTime stopWatch;
     1702    QElapsedTimer stopWatch;
    17031703    stopWatch.start();
    17041704
     
    17501750    QSOCKS5_DEBUG << "waitForWrite" << msecs;
    17511751
    1752     QTime stopWatch;
     1752    QElapsedTimer stopWatch;
    17531753    stopWatch.start();
    17541754
  • trunk/src/network/socket/qsocks5socketengine_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qtcpserver.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    563563    use its setSocketDescriptor() method.
    564564
    565     \sa newConnection(), nextPendingConnection()
     565    \sa newConnection(), nextPendingConnection(), addPendingConnection()
    566566*/
    567567void QTcpServer::incomingConnection(int socketDescriptor)
     
    573573    QTcpSocket *socket = new QTcpSocket(this);
    574574    socket->setSocketDescriptor(socketDescriptor);
     575    addPendingConnection(socket);
     576}
     577
     578/*!
     579    This function is called by QTcpServer::incomingConnection()
     580    to add the \a socket to the list of pending incoming connections.
     581
     582    \note Don't forget to call this member from reimplemented
     583    incomingConnection() if you do not want to break the
     584    Pending Connections mechanism.
     585
     586    \sa incomingConnection()
     587    \since 4.7
     588*/
     589void QTcpServer::addPendingConnection(QTcpSocket* socket)
     590{
    575591    d_func()->pendingConnections.append(socket);
    576592}
  • trunk/src/network/socket/qtcpserver.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    9494protected:
    9595    virtual void incomingConnection(int handle);
     96    void addPendingConnection(QTcpSocket* socket);
    9697
    9798Q_SIGNALS:
  • trunk/src/network/socket/qtcpsocket.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qtcpsocket.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qtcpsocket_p.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qudpsocket.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
  • trunk/src/network/socket/qudpsocket.h

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
Note: See TracChangeset for help on using the changeset viewer.