Changeset 651 for trunk/src/network/socket
- Timestamp:
- Mar 8, 2010, 12:52:58 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.2 (added) merged: 650 /branches/vendor/nokia/qt/current merged: 649 /branches/vendor/nokia/qt/4.6.1 removed
- Property svn:mergeinfo changed
-
trunk/src/network/socket/qabstractsocket.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 521 521 #if defined (QABSTRACTSOCKET_DEBUG) 522 522 QString typeStr; 523 if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = "TcpSocket";524 else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = "UdpSocket";525 else typeStr = "UnknownSocketType";523 if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = ; 524 else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = ; 525 else typeStr = ; 526 526 QString protocolStr; 527 if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = "IPv4Protocol";528 else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = "IPv6Protocol";529 else protocolStr = "UnknownNetworkLayerProtocol";527 if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = ; 528 else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = ; 529 else protocolStr = ; 530 530 #endif 531 531 … … 874 874 return; 875 875 876 877 878 879 876 880 addresses = hostInfo.addresses(); 877 881 878 882 #if defined(QABSTRACTSOCKET_DEBUG) 879 QString s = "{";883 QString s = ; 880 884 for (int i = 0; i < addresses.count(); ++i) { 881 if (i != 0) s += ", ";885 if (i != 0) s += ; 882 886 s += addresses.at(i).toString(); 883 887 } 884 s += '}';888 s += ; 885 889 qDebug("QAbstractSocketPrivate::_q_startConnecting(hostInfo == %s)", s.toLatin1().constData()); 886 890 #endif -
trunk/src/network/socket/qabstractsocket.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qabstractsocket_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qabstractsocketengine.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qabstractsocketengine_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qhttpsocketengine.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 213 213 { 214 214 Q_D(QHttpSocketEngine); 215 qint64 bytesRead = 0; 216 217 if (!d->readBuffer.isEmpty()) { 218 // Read as much from the buffer as we can. 219 bytesRead = qMin((qint64)d->readBuffer.size(), maxlen); 220 memcpy(data, d->readBuffer.constData(), bytesRead); 221 data += bytesRead; 222 maxlen -= bytesRead; 223 d->readBuffer = d->readBuffer.mid(bytesRead); 224 } 225 226 qint64 bytesReadFromSocket = d->socket->read(data, maxlen); 215 qint64 bytesRead = d->socket->read(data, maxlen); 227 216 228 217 if (d->socket->state() == QAbstractSocket::UnconnectedState … … 231 220 } 232 221 233 if (bytesReadFromSocket > 0) { 234 // Add to what we read so far. 235 bytesRead += bytesReadFromSocket; 236 } else if (bytesRead == 0 && bytesReadFromSocket == -1) { 222 if (bytesRead == -1) { 237 223 // If nothing has been read so far, and the direct socket read 238 224 // failed, return the socket's error. Otherwise, fall through and … … 561 547 562 548 QHttpResponseHeader responseHeader(QString::fromLatin1(d->readBuffer)); 563 d->readBuffer.clear(); 549 d->readBuffer.clear(); 564 550 565 551 int statusCode = responseHeader.statusCode(); -
trunk/src/network/socket/qhttpsocketengine_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 163 163 QString peerName; 164 164 QTcpSocket *socket; 165 QByteArray readBuffer; 165 QByteArray readBuffer; 166 166 QHttpSocketEngine::HttpState state; 167 167 QAuthenticator authenticator; -
trunk/src/network/socket/qlocalserver.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalserver.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalserver_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalserver_tcp.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalserver_unix.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalserver_win.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalsocket.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalsocket.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalsocket_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalsocket_tcp.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalsocket_unix.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qlocalsocket_win.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qnativesocketengine.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 779 779 close(); 780 780 return -1; 781 782 783 784 785 781 786 } 782 787 return readBytes; -
trunk/src/network/socket/qnativesocketengine_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qnativesocketengine_unix.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qnativesocketengine_win.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 995 995 Q_Q(QNativeSocketEngine); 996 996 qint64 ret = 0; 997 // don't send more than 49152 per call to WSASendTo to avoid getting a WSAENOBUFS 997 qint64 bytesToSend = len; 998 998 999 for (;;) { 999 qint64 bytesToSend = qMin<qint64>(49152, len - ret);1000 1000 WSABUF buf; 1001 1001 buf.buf = (char*)data + ret; … … 1008 1008 ret += qint64(bytesWritten); 1009 1009 1010 1010 1011 if (socketRet != SOCKET_ERROR) { 1011 1012 if (ret == len) … … 1013 1014 else 1014 1015 continue; 1015 } else if (WSAGetLastError() == WSAEWOULDBLOCK) { 1016 break; 1016 } else if ((err = WSAGetLastError()) == WSAEWOULDBLOCK) { 1017 break; 1018 } else if (err == WSAENOBUFS) { 1019 // this function used to not send more than 49152 per call to WSASendTo 1020 // to avoid getting a WSAENOBUFS. However this is a performance regression 1021 // and we think it only appears with old windows versions. We now handle the 1022 // WSAENOBUFS and hope it never appears anyway. 1023 // just go on, the next loop run we will try a smaller number 1017 1024 } else { 1018 int err = WSAGetLastError();1019 1025 WS_ERROR_DEBUG(err); 1020 1026 switch (err) { … … 1030 1036 break; 1031 1037 } 1038 1039 1040 1032 1041 } 1033 1042 … … 1191 1200 qDebug("QNativeSocketEnginePrivate::nativeClose()"); 1192 1201 #endif 1193 linger l = {1, 0}; 1194 ::setsockopt(socketDescriptor, SOL_SOCKET, SO_DONTLINGER, (char*)&l, sizeof(l)); 1202 // We were doing a setsockopt here before with SO_DONTLINGER. (However with kind of wrong 1203 // usage of parameters, it wants a BOOL but we used a struct and pretended it to be bool). 1204 // We don't think setting this option should be done here, if a user wants it she/he can 1205 // do it manually with socketDescriptor()/setSocketDescriptor(); 1195 1206 ::closesocket(socketDescriptor); 1196 1207 } -
trunk/src/network/socket/qnet_unix_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qsocks5socketengine.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qsocks5socketengine_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qtcpserver.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qtcpserver.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qtcpsocket.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qtcpsocket.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qtcpsocket_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qudpsocket.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) -
trunk/src/network/socket/qudpsocket.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected])
Note:
See TracChangeset
for help on using the changeset viewer.