diff options
Diffstat (limited to 'src/network/access/qftp.cpp')
-rw-r--r-- | src/network/access/qftp.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 4f17dc8..5931a67 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -314,8 +314,10 @@ void QFtpDTP::connectToHost(const QString & host, quint16 port) { bytesFromSocket.clear(); - if (socket) + if (socket) { delete socket; + socket = 0; + } socket = new QTcpSocket(this); socket->setObjectName(QLatin1String("QFtpDTP Passive state socket")); connect(socket, SIGNAL(connected()), SLOT(socketConnected())); @@ -869,6 +871,9 @@ void QFtpPI::connected() #if defined(QFTPPI_DEBUG) // qDebug("QFtpPI state: %d [connected()]", state); #endif + // try to improve performance by setting TCP_NODELAY + commandSocket.setSocketOption(QAbstractSocket::LowDelayOption, 1); + emit connectState(QFtp::Connected); } @@ -1291,9 +1296,9 @@ int QFtpPrivate::addCommand(QFtpCommand *cmd) \class QFtp \brief The QFtp class provides an implementation of the client side of FTP protocol. - \ingroup io + \ingroup network \inmodule QtNetwork - \mainclass + This class provides a direct interface to FTP that allows you to have more control over the requests. However, for new @@ -1385,7 +1390,7 @@ int QFtpPrivate::addCommand(QFtpCommand *cmd) \warning The current version of QFtp doesn't fully support non-Unix FTP servers. - \sa QHttp, QNetworkAccessManager, QNetworkRequest, QNetworkReply, + \sa QNetworkAccessManager, QNetworkRequest, QNetworkReply, {FTP Example} */ @@ -1658,11 +1663,12 @@ QFtp::QFtp(QObject *parent, const char *name) */ int QFtp::connectToHost(const QString &host, quint16 port) { - d_func()->pi.transferConnectionExtended = true; QStringList cmds; cmds << host; cmds << QString::number((uint)port); - return d_func()->addCommand(new QFtpCommand(ConnectToHost, cmds)); + int id = d_func()->addCommand(new QFtpCommand(ConnectToHost, cmds)); + d_func()->pi.transferConnectionExtended = true; + return id; } /*! @@ -1721,17 +1727,18 @@ int QFtp::close() */ int QFtp::setTransferMode(TransferMode mode) { + int id = d_func()->addCommand(new QFtpCommand(SetTransferMode, QStringList())); d_func()->pi.transferConnectionExtended = true; d_func()->transferMode = mode; - return d_func()->addCommand(new QFtpCommand(SetTransferMode, QStringList())); + return id; } /*! Enables use of the FTP proxy on host \a host and port \a port. Calling this function with \a host empty disables proxying. - QFtp does not support FTP-over-HTTP proxy servers. Use QHttp for - this. + QFtp does not support FTP-over-HTTP proxy servers. Use + QNetworkAccessManager for this. */ int QFtp::setProxy(const QString &host, quint16 port) { |