From 947052917524433263ea02d83ba28f08260add1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 14 Jun 2021 13:27:46 +0200 Subject: QNativeSocketEngine: Delete old win7 compat code It's no longer used today. And while we're at it: delete or fix typos in some nearby comments Change-Id: Ib52268eeb936e71d6c09aece2e0833b99309ef2d Reviewed-by: Edward Welbourne --- src/network/socket/qnativesocketengine_win.cpp | 34 +++----------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index 7b5e674fbb..b2ab8a9fdf 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -294,15 +294,6 @@ static inline QAbstractSocket::SocketType qt_socket_getType(qintptr socketDescri bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol &socketProtocol) { - - //### no ip6 support on winsocket 1.1 but we will try not to use this !!!!!!!!!!!!1 - /* - if (winsockVersion < 0x20 && socketProtocol == QAbstractSocket::IPv6Protocol) { - //### no ip6 support - return -1; - } - */ - //### SCTP not implemented if (socketType == QAbstractSocket::SctpSocket) { setError(QAbstractSocket::UnsupportedSocketOperationError, @@ -315,34 +306,15 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc || (socketProtocol == QAbstractSocket::AnyIPProtocol)) ? AF_INET6 : AF_INET; int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM; - // MSDN KB179942 states that on winnt 4 WSA_FLAG_OVERLAPPED is needed if socket is to be non blocking - // and recomends alwasy doing it for cross windows version comapablity. + // MSDN KB179942 states that on winnt 4 WSA_FLAG_OVERLAPPED is needed if socket is to be non + // blocking and recommends always doing it for cross-windows-version compatibility. - // WSA_FLAG_NO_HANDLE_INHERIT is atomic (like linux O_CLOEXEC), but requires windows 7 SP 1 or later - // SetHandleInformation is supported since W2K but isn't atomic + // WSA_FLAG_NO_HANDLE_INHERIT is atomic (like linux O_CLOEXEC) #ifndef WSA_FLAG_NO_HANDLE_INHERIT #define WSA_FLAG_NO_HANDLE_INHERIT 0x80 #endif SOCKET socket = ::WSASocket(protocol, type, 0, NULL, 0, WSA_FLAG_NO_HANDLE_INHERIT | WSA_FLAG_OVERLAPPED); - // previous call fails if the windows 7 service pack 1 or hot fix isn't installed. - - // Try the old API if the new one failed on Windows 7 - if (socket == INVALID_SOCKET && QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8) { - socket = ::WSASocket(protocol, type, 0, NULL, 0, WSA_FLAG_OVERLAPPED); -#ifdef HANDLE_FLAG_INHERIT - if (socket != INVALID_SOCKET) { - // make non inheritable the old way - BOOL handleFlags = SetHandleInformation(reinterpret_cast(socket), HANDLE_FLAG_INHERIT, 0); -#ifdef QNATIVESOCKETENGINE_DEBUG - qDebug() << "QNativeSocketEnginePrivate::createNewSocket - set inheritable" << handleFlags; -#else - Q_UNUSED(handleFlags); -#endif - } -#endif - } - if (socket == INVALID_SOCKET) { int err = WSAGetLastError(); WS_ERROR_DEBUG(err); -- cgit v1.2.1