Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtNetwork module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6060QT_BEGIN_NAMESPACE
    6161
     62
     63
     64
    6265static const int MaxWriteBufferSize = 128*1024;
     66
    6367
    6468//#define QSOCKS5SOCKETLAYER_DEBUG
     
    154158static bool qt_socks5_set_host_address_and_port(const QHostAddress &address, quint16 port, QByteArray *pBuf)
    155159{
    156     QSOCKS5_DEBUG << "setting [" << address << ":" << port << "]";
     160    QSOCKS5_DEBUG << "setting [" << address << ;
    157161
    158162    union {
     
    187191static bool qt_socks5_set_host_name_and_port(const QString &hostname, quint16 port, QByteArray *pBuf)
    188192{
    189     QSOCKS5_DEBUG << "setting [" << hostname << ":" << port << "]";
     193    QSOCKS5_DEBUG << "setting [" << hostname << ;
    190194
    191195    QByteArray encodedHostName = QUrl::toAce(hostname);
     
    266270
    267271    if (ret) {
    268         QSOCKS5_DEBUG << "got [" << address << ":" << port << "]";
     272        QSOCKS5_DEBUG << "got [" << address << ;
    269273        *pAddress = address;
    270274        *pPort = port;
     
    11251129{
    11261130    Q_D(QSocks5SocketEngine);
    1127     QSOCKS5_DEBUG << "connectToHost" << address << ":" << port;
     1131    QSOCKS5_DEBUG << "connectToHost" << address << << port;
    11281132
    11291133    setPeerAddress(address);
     
    12321236            connectData->readBuffer.clear();
    12331237        emitReadNotification();
     1238
     1239
     1240
    12341241    } else if (socks5State == Uninitialized
    12351242               || socks5State == AuthenticationMethodsSent
     
    12421249        q_func()->setError(data->controlSocket->error(), data->controlSocket->errorString());
    12431250        emitReadNotification();
     1251
    12441252    }
    12451253}
     
    13801388            return false;
    13811389        }
    1382         QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << ":" << d->localPort;
     1390        QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << << d->localPort;
    13831391        return true;
    13841392#endif // QT_NO_UDPSOCKET
     
    14791487{
    14801488    Q_D(QSocks5SocketEngine);
    1481     QSOCKS5_Q_DEBUG << "read( , maxlen = " << maxlen << ")";
     1489    QSOCKS5_Q_DEBUG << "read( , maxlen = " << maxlen << ;
    14821490    if (d->mode == QSocks5SocketEnginePrivate::ConnectMode) {
    14831491        if (d->connectData->readBuffer.size() == 0) {
     
    16201628#endif // QT_NO_UDPSOCKET
    16211629
     1630
     1631
     1632
     1633
     1634
     1635
     1636
     1637
     1638
     1639
    16221640int QSocks5SocketEngine::option(SocketOption option) const
    16231641{
    1624     Q_UNUSED(option);
     1642    Q_D(const QSocks5SocketEngine);
     1643    if (d->data && d->data->controlSocket) {
     1644        // convert the enum and call the real socket
     1645        if (option == QAbstractSocketEngine::LowDelayOption)
     1646            return d->data->controlSocket->socketOption(QAbstractSocket::LowDelayOption).toInt();
     1647        if (option == QAbstractSocketEngine::KeepAliveOption)
     1648            return d->data->controlSocket->socketOption(QAbstractSocket::KeepAliveOption).toInt();
     1649    }
    16251650    return -1;
    16261651}
     
    16281653bool QSocks5SocketEngine::setOption(SocketOption option, int value)
    16291654{
    1630     Q_UNUSED(option);
    1631     Q_UNUSED(value);
     1655    Q_D(QSocks5SocketEngine);
     1656    if (d->data && d->data->controlSocket) {
     1657        // convert the enum and call the real socket
     1658        if (option == QAbstractSocketEngine::LowDelayOption)
     1659            d->data->controlSocket->setSocketOption(QAbstractSocket::LowDelayOption, value);
     1660        if (option == QAbstractSocketEngine::KeepAliveOption)
     1661            d->data->controlSocket->setSocketOption(QAbstractSocket::KeepAliveOption, value);
     1662        return true;
     1663    }
    16321664    return false;
    16331665}
     
    17671799    Q_D(QSocks5SocketEngine);
    17681800
    1769     QSOCKS5_Q_DEBUG << "setReadNotificationEnabled(" << enable << ")";
     1801    QSOCKS5_Q_DEBUG << "setReadNotificationEnabled(" << enable << ;
    17701802
    17711803    bool emitSignal = false;
     
    18311863        return 0;
    18321864    }
    1833     QSocks5SocketEngine *engine = new QSocks5SocketEngine(parent);
     1865    QS);
    18341866    engine->setProxy(proxy);
    1835     return engine;
     1867    return engine;
    18361868}
    18371869
Note: See TracChangeset for help on using the changeset viewer.