summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnativesocketengine_win.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QAbstractSocketEngine: port to QDeadlineTimerAhmad Samir2023-10-071-11/+19
| | | | | | | | | | | | | | | | qnativesocketengine_win.cpp: don't check if timeout is < 0, because remainingTimeAsDuration() doesn't return negative values. All the changes done in one go, not function by function, as that causes the least churn. You can think of them as a couple of very similar changes repeated various times. Drive-by change: replace `forever {` with `for (;;)` Task-number: QTBUG-113518 Change-Id: Ie9f20031bf0d4ff19e5b2da5034822ba61f9cbc3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove the manual undef of the min/max macros, or def NOMINMAXAmir Masoud Abdol2023-06-081-3/+0
| | | | | | | | | | We now add NOMINMAX to PlatformCommonInternal target which will be linked to everything else, so min/max will not be defined upon the inclusion of `windows.h`, or other headers. Pick-to: 6.5 6.6 Change-Id: I10016720dac7ce015e929885b7368ee86d8b6918 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QtNetwork: Split out QNativeSocketEnginePrivateFriedemann Kleint2023-02-021-1/+1
| | | | | | | | | | | The aim is to have fewer files including <windows.h>. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Id9cc08f54b5daf6d7e317fad27036dc2efaacbb8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make sockets' accept() methods return qintptrMårten Nordheim2022-08-241-6/+6
| | | | | | | | | | | Not necessarily relevant outside windows, where the socket descriptor is SOCKET (= unsigned 64-bit). Also follow their recommendation to not compare to -1, but rather to INVALID_SOCKET. Pick-to: 6.4 6.3 6.2 Change-Id: I0cfa4dfd9e147469132e2e72de22b30eab01e15c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add missing includes for some of our _win.cpp filesMårten Nordheim2022-03-181-0/+1
| | | | | Change-Id: I74067f5d50bea6fbc16576c26bf84f91e449e497 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* network: Fix typos in source code commentsJonas Kvinge2021-10-121-1/+1
| | | | | | Change-Id: Iff505451e3f00de2d753de0f1d891a73cf73ef0d Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNativeSocketEngine: Delete old win7 compat codeMårten Nordheim2021-06-141-31/+3
| | | | | | | | | 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 <edward.welbourne@qt.io>
* Consolidate debug string generationAlex Trotsenko2021-05-311-38/+7
| | | | | | | | | | | | | | Several QIODevice subclasses use the qt_prettyDebug() function to get a printable representation of the buffer data for debug output. Rather than having this feature statically implemented in each respective file, this patch introduces a generic function in the QtDebugUtils namespace. Accordingly, some inaccuracies in the use-cases have been corrected. Change-Id: I1a8465cab08c8acf5fdcdba5085182511b1cbb7b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove unreachable codeTang Peng2021-03-111-1/+0
| | | | | | | | Having a `break` after a `return` is pointless as it's never reached. Change-Id: I30877e926c006fac45681f547e97a55410f02e43 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove redundant invalid socket checkEdward Welbourne2021-02-181-5/+3
| | | | | | | | | It happens after the same socket check has lead to an early return. Prompted by a PVS-studio article. Change-Id: I63b42abed9102df73d29e6ff8a89a475751d4b91 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNativeSocketEngine/Win: fix write() in case of splittingAlex Trotsenko2020-07-281-3/+1
| | | | | | | | | | | | When a first call to ::WSASend() consumes less data than requested, we are trying to make a second call, leaving 'bytesToSend' unmodified. Instead of setting a new value for 'bytesToSend', it seems reasonable to break the loop, if the system buffer overflow detected. Pick-to: 5.15 Change-Id: I8038e95c20221518955efe786f2d0dadb98360fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-02-181-1/+2
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qlinkedlist.h src/plugins/platforms/wasm/qwasmintegration.cpp src/plugins/platforms/wasm/qwasmscreen.cpp Change-Id: Iefca7f9f4966bdc20e7052aca736874861055738
| * QTcpSocket::bind: fix issue found by BLACKLISTThiago Macieira2020-02-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | The comment in QNativeSocketEnginePrivate::fetchConnectionParameters() talked about IPv6 v4-mapped addresses. However, toIPv4Address also converts the unspecified address (::), which resulted in QAbstractSocket saying that it had bound to QHostAddress::Any instead of QHostAddress::AnyV6 Change-Id: I572733186b73423b89e5fffd15f138579c5c0c50 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Win: QUdpSocket: Use QVarLengthArray for retrieving sizeMårten Nordheim2019-10-111-6/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Increased size of the peek buffer to 2048 from 1500 and now uses QVarLengthArray with space for 10 stack-allocated WSABUF instances, but still growing at the pace of 5. In benchmarking (created for and included in this patch) this shows better performance when retrieving the datagram size for larger datagrams, and the same performance as before for smaller datagrams (at the cost of 2048 - 1500 + 16 * 10 = 708 bytes extra stack space). Benchmarks: With changes: ********* Start testing of tst_QUdpSocket ********* Config: Using QtTest library 5.13.1, Qt 5.13.1 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2019) PASS : tst_QUdpSocket::initTestCase() PASS : tst_QUdpSocket::pendingDatagramSize(52) RESULT : tst_QUdpSocket::pendingDatagramSize():"52": 0.0038 msecs per iteration (total: 63, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(1024) RESULT : tst_QUdpSocket::pendingDatagramSize():"1024": 0.0039 msecs per iteration (total: 64, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(2049) RESULT : tst_QUdpSocket::pendingDatagramSize():"2049": 0.0038 msecs per iteration (total: 63, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(4500) RESULT : tst_QUdpSocket::pendingDatagramSize():"4500": 0.0039 msecs per iteration (total: 64, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(4098) RESULT : tst_QUdpSocket::pendingDatagramSize():"4098": 0.0040 msecs per iteration (total: 66, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(8192) RESULT : tst_QUdpSocket::pendingDatagramSize():"8192": 0.0040 msecs per iteration (total: 67, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(12000) RESULT : tst_QUdpSocket::pendingDatagramSize():"12000": 0.010 msecs per iteration (total: 90, iterations: 8192) PASS : tst_QUdpSocket::pendingDatagramSize(25000) RESULT : tst_QUdpSocket::pendingDatagramSize():"25000": 0.021 msecs per iteration (total: 88, iterations: 4096) PASS : tst_QUdpSocket::pendingDatagramSize(32768) RESULT : tst_QUdpSocket::pendingDatagramSize():"32768": 0.033 msecs per iteration (total: 69, iterations: 2048) PASS : tst_QUdpSocket::pendingDatagramSize(64512) RESULT : tst_QUdpSocket::pendingDatagramSize():"64512": 0.088 msecs per iteration (total: 91, iterations: 1024) PASS : tst_QUdpSocket::cleanupTestCase() Totals: 12 passed, 0 failed, 0 skipped, 0 blacklisted, 3090ms ********* Finished testing of tst_QUdpSocket ********* Without changes: ********* Start testing of tst_QUdpSocket ********* Config: Using QtTest library 5.13.1, Qt 5.13.1 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2019) PASS : tst_QUdpSocket::initTestCase() PASS : tst_QUdpSocket::pendingDatagramSize(52) RESULT : tst_QUdpSocket::pendingDatagramSize():"52": 0.0039 msecs per iteration (total: 65, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(1024) RESULT : tst_QUdpSocket::pendingDatagramSize():"1024": 0.0039 msecs per iteration (total: 65, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(2049) RESULT : tst_QUdpSocket::pendingDatagramSize():"2049": 0.0040 msecs per iteration (total: 66, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(4500) RESULT : tst_QUdpSocket::pendingDatagramSize():"4500": 0.0040 msecs per iteration (total: 67, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(4098) RESULT : tst_QUdpSocket::pendingDatagramSize():"4098": 0.0040 msecs per iteration (total: 67, iterations: 16384) PASS : tst_QUdpSocket::pendingDatagramSize(8192) RESULT : tst_QUdpSocket::pendingDatagramSize():"8192": 0.010 msecs per iteration (total: 90, iterations: 8192) PASS : tst_QUdpSocket::pendingDatagramSize(12000) RESULT : tst_QUdpSocket::pendingDatagramSize():"12000": 0.010 msecs per iteration (total: 90, iterations: 8192) PASS : tst_QUdpSocket::pendingDatagramSize(25000) RESULT : tst_QUdpSocket::pendingDatagramSize():"25000": 0.033 msecs per iteration (total: 69, iterations: 2048) PASS : tst_QUdpSocket::pendingDatagramSize(32768) RESULT : tst_QUdpSocket::pendingDatagramSize():"32768": 0.0502 msecs per iteration (total: 103, iterations: 2048) PASS : tst_QUdpSocket::pendingDatagramSize(64512) RESULT : tst_QUdpSocket::pendingDatagramSize():"64512": 0.13 msecs per iteration (total: 70, iterations: 512) PASS : tst_QUdpSocket::cleanupTestCase() Totals: 12 passed, 0 failed, 0 skipped, 0 blacklisted, 3192ms ********* Finished testing of tst_QUdpSocket ********* Fixes: QTBUG-78275 Change-Id: If86a226620244aa4e470600c6c1db4a7863b5617 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-121-60/+55
|\ | | | | | | | | | | | | | | | | | | Conflicts: configure.pri Also required s/solid\.color/solidColor/ in a couple of places in: src/gui/painting/qpaintengine_raster.cpp Change-Id: I29937f63e9779deb6dac7ae77e2948d06ebc0319
| * Windows: handle errors correctly when connecting to unreachable hostVolker Hilsheimer2019-07-111-60/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous code handled only some error codes, in a very inefficient way, for some code paths. This change standardizes error handling using a helper function that maps winsock WSAE* codes to Qt error codes. The test for connecting to unreachable hosts or ports is now more generic, and enabled on Windows, where it passes in local tests, but dependency on network configuration still makes it fragile, so ignoring some failures without completely skipping the test. [ChangeLog][Network][Windows] Correctly emit errors when trying to reach unreachable hosts or services Change-Id: Icaca3e6fef88621d683f6d6fa3016212847de4ea Fixes: QTBUG-42567 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-031-12/+12
|\| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I936be3c0df2b9845ff6a85eb3d4442cdabe63d37
| * Fix compiler warnings when building with DEBUG defines setVolker Hilsheimer2019-07-021-12/+12
| | | | | | | | | | Change-Id: I51fc7aae246916e585b21b4e7da1fc5a4ac392fd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | qnativesocketengine_win.cpp: Improve memory handlingIvan Komissarov2018-11-181-18/+8
|/ | | | | | | | | | | | | We use std::vector and thus RAII instead of manual memory management. std::vector (re)allocates only if needed, growing exponentially, initializing only new elements. std::vector<>::resize also makes initialization loop redundant Task-number: QTBUG-71156 Change-Id: I253bb428c0fb641872f0f7f2dcfe1f9e89db0296 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Windows code: Fix clang-tidy warnings about C-style castsFriedemann Kleint2018-08-301-3/+4
| | | | | | | | | | | Replace by reinterpret_cast or const_cast, respectively. Use auto when initializing a variable to fix Clang warnings about repeating the type name, do minor tidying along the way, and a few conversions of 0 or NULL to nullptr. Change-Id: Ieb271a87ddcf064f536e1ff05d23b1e688b1b56a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNativeSocketEnginePrivate (win) read sender's port and addressTimur Pocheptsov2018-06-141-0/+2
| | | | | | | | | | even if recvmsg results in WSAEMSGSIZE. Task-number: QTBUG-68755 Change-Id: I418e924b3e9001e7b7ad991e32d7d6f89ae499af Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.10' into devLars Knoll2018-01-021-1/+25
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
| * tst_QUdpSocket: always use an interface when binding to IPv6Thiago Macieira2017-12-291-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Binding without an interface and expecting the OS to select something is not supported in all OSes. On FreeBSD, I keep getting EADDRNOTAVAIL. So modify our test to only join, leave and send to multicast groups with an interface selection. With this, all tests either pass or are skipped for me on Linux, FreeBSD, and macOS. On Windows, this revealed an inconsistency in behavior, which this commit adds a workaround for. Change-Id: Ifb5969bf206e4cd7b14efffd14fb6815456494d2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-301-4/+2
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/thread/qsemaphore.cpp tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Id35b535e88df63fdfe4007ea92ed4a39c4b6d707
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-281-4/+2
| |\ | | | | | | | | | Change-Id: Iede384644c3df5ee01b701806dfdb586dd6bb138
| | * QUdpSocket: Work around WSARecvMsg quirk relating to no control blockThiago Macieira2017-11-251-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WSARecvMsg does not return the sender in WSAMSG::name if WSAMSG::Control isn't set. This makes no sense, so I'm assuming it's an API quirk we need to work around. [ChangeLog][QtNetwork][QUdpSocket] Fixed a regression from Qt 5.9.3 caused by an apparent Win32 API quirk we triggered when using readDatagram(), resulting in an invalid QHostAddress sender address. receiveDatagram() was not affected. Task-number: QTBUG-64718 Change-Id: I71488efd29b645f7b228fffd14f9d84cc205c4b3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-231-9/+11
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttp2protocolhandler_p.h src/network/kernel/kernel.pri src/network/ssl/qsslkey_qt.cpp src/plugins/platforms/cocoa/qcocoascreen.mm src/plugins/platforms/windows/accessible/iaccessible2.cpp src/plugins/platforms/windows/accessible/iaccessible2.h src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h src/widgets/widgets/qmenu_p.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/other/qaccessibility/tst_qaccessibility.cpp tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-091-9/+11
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qwindow.cpp src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowssystemtrayicon.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp tests/auto/widgets/kernel/qaction/tst_qaction.cpp Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
| | * QNativeSocketEngine/Win: fix getting the datagram destinationThiago Macieira2017-11-041-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looks like I never even tested this. There were two problems: 1) when we asked for the recvmsg and sendmsg functions, we used the wrong variable (socketDescriptor was still -1) 2) we extracted the destination addresses, but never set them in the QIpPacketHeader object The added tests confirm that this works on Windows, Linux, Darwin, FreeBSD. There also seems to be a problem, obtaining the destination address on an IPv4 socket with a dual-stack sender (I can reproduce that on FreeBSD, macOS and Windows, plus an old version of Linux). Task-number: QTBUG-63605 Change-Id: I638cf58bfa7b4e5fb386fffd14ea732bddbc0c42 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | QAbstractSocket: Add socketOption for the Path MTUThiago Macieira2017-11-141-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allow retrieving the value of the known PMTU for the current socket. This works on Linux (IPv6 and IPv4) and FreeBSD (IPv6 only) -- the other OSes don't have the necessary API. Note: do we need add IP_MTU_DISCOVER? Change-Id: I6e9274c1e7444ad48c81fffd14dcaf97a18ce335 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Qt Network: Remove code for Windows < 7Friedemann Kleint2017-09-291-8/+3
|/ / | | | | | | | | Change-Id: I21b93b8d550f4a1f3e26d5d516886c76b2364e7b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | QNativeSocketEngine: reduce memory usage in nativePendingDatagramSize()Thiago Macieira2017-09-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Windows implementation had the right idea: by using a chunked read, we can tell the OS to reuse the same buffer over and over, so we don't need to grow a buffer to the size of the datagram when peeking. This commit implements that strategy on Unix and changes both implementations to start at 1500 bytes instead of 8192 (1500 is more than enough for almost all datagrams we're going to receive). Let's also not use a static buffer, but a stack-based one. No need to dedicate 1500 (or, worse, 8192) bytes for something that is only seldom called. Change-Id: I320d9d2f42284a69a4cbfffd14dd92a6775bf28b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devOswald Buddenhagen2017-08-021-1/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/widgets/qdockarealayout.cpp src/widgets/widgets/qmainwindow.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmainwindowlayout_p.h tests/auto/corelib/tools/qlocale/tst_qlocale.cpp tests/auto/other/macnativeevents/BLACKLIST tests/auto/widgets/widgets/qmenu/BLACKLIST Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
| * Fix bytesAvailable() on UDP under WindowsAlex Trotsenko2017-07-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When ::WSAIoctl() reports 1 byte available for reading, we are trying to peek an incoming datagram to ensure that the data is actually delivered. But, according to MSDN docs, we are not allowed to pass NULL as 'lpNumberOfBytesRecvd' parameter to ::WSARecvFrom() call, if 'lpOverlapped' parameter is also NULL. The case with an empty datagram is fixed accordingly. Change-Id: Id13038245332d3fb4bc18038d44a7cfd7ce04775 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-041-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
| * QNativeSocketEnginePrivate::nativeAccept(): Add missing breakFriedemann Kleint2017-06-281-0/+1
| | | | | | | | | | | | | | | | | | Fixes GCC 7 warning: socket\qnativesocketengine_win.cpp:888:21: warning: this statement may fall through [-Wimplicit-fallthrough=] Change-Id: Idb4dce511b3ab634339ac1283d88def283a92028 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-021-4/+10
|\| | | | | | | Change-Id: I84097f8e7b3b2128028bd7693c913d6968b82bfe
| * Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-241-4/+10
| |\ | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/moc.prf Change-Id: Ia71c8e3b3185f7c999bf226d0675051b10b8740b
| | * Fix multicastMembershipHelper to not assume addresses are IPv4Edward Welbourne2017-02-221-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it iterate the addresses available looking for an IPv4 address, when that's what it needs, instead of just assuming the first entry in the list (when non-empty) is IPv4. Based on a suggestion by Dmitry Pankratov. Task-number: QTBUG-27641 Change-Id: I1920f68ade44a996ea5c2ed691a87ff3e686f35a Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Join two else/if lines that were left splitEdward Welbourne2017-02-211-3/+1
|/ / | | | | | | | | | | | | Probably after-effects of some #if-ery we removed long ago ... Change-Id: I8bf7a97dc5fda615bf20c37ccd9c1de0ba9194e5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | qnativesocketengine_win.cpp: Fix comparison of OS versionFriedemann Kleint2016-12-091-10/+3
| | | | | | | | | | | | | | | | | | | | Rewrite code to assume Windows 7 as minimum supported version and check using the operators of QOperatingSystemVersion. Amends change e26c59e564023b89336d97f7a838cacd7c9cb9e3. Change-Id: I47cdd4f53ef55441ac7c1f6b1c15f8d4983d70b1 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | qnativesocketengine_win.cpp: Use QOperatingSystemVersion to detect OSFriedemann Kleint2016-11-251-4/+7
|/ | | | | | | | | | | | | | | | | Fix warning: socket\qnativesocketengine_win.cpp: In member function 'bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType, QAbstractSocket::NetworkLayerProtocol&)': socket\qnativesocketengine_win.cpp:337:26: warning: 'WinVersion' is deprecated: Use QOperatingSystemVersion [-Wdeprecated-declarations] QSysInfo::WinVersion osver = QSysInfo::windowsVersion(); ^ In file included from ..\..\include/QtCore/qsysinfo.h:1:0, from ..\..\include\QtCore/../../src/corelib/global/qglobal.h:1150, from ..\..\include\QtCore/qglobal.h:1, from ..\corelib\global\qt_pch.h:56: enum QT_DEPRECATED_X("Use QOperatingSystemVersion") WinVersion { Change-Id: I9b060d886af3b627ac4b6eeb3321629734cc1e46 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Support C++17 fallthrough attributeAllan Sandfeld Jensen2016-08-191-1/+1
| | | | | | | | | Replaces our mix of comments for annotating intended absence of break in switches with the C++17 attribute [[fallthrough]], or its earlier a clang extension counterpart. Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introduce SCTP sockets supportAlex Trotsenko2016-07-271-0/+11
| | | | | | | Add protocol-specific code and the QSctpServer, QSctpSocket classes. Change-Id: Ie9a1d87bd1fda866a2405043d1c15c12ded5a96e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-121-8/+23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure src/corelib/io/qprocess_wince.cpp src/plugins/platforms/windows/qwindowstheme.cpp src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qtimezone/BLACKLIST tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-061-7/+22
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/qtestlib/tutorial5/containers.cpp examples/widgets/tools/tools.pro src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/network/kernel/qdnslookup_unix.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp tools/configure/configureapp.cpp Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
| | * Avoid use of v4-mapped QHostAddress::AnyIPv4 local address on WindowsAlex Trotsenko2016-05-041-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some Windows kernels return a v4-mapped QHostAddress::AnyIPv4 as a local address of the socket which bound on both IPv4 and IPv6 interfaces. This address does not match to any special address and should not be used to send the data. To allow handling of the local addresses properly, replace it with QHostAddress::Any. Already tested by tst_qudpsocket. Task-number: QTBUG-52714 Change-Id: Icb7cb75f48cd7ec9b0a9dfaf861ffe0d3093e20d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * QNativeSocketEngine: fix build in debug mode under WindowsAlex Trotsenko2016-05-021-7/+9
| | | | | | | | | | | | | | | Change-Id: Id9b42f3d40b82ae6a8d581b0fbf6fd0b2ae589aa Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>