summaryrefslogtreecommitdiffstats
path: root/src/network/socket
Commit message (Collapse)AuthorAgeFilesLines
* Use QHttpHeaders: Update internal users of QNRequest, QNReply, QNProxyLena Biliaieva7 days1-4/+7
| | | | | | | | | | | | | Replace QNetworkHeadersPrivate's main headers storage, which was RawHeadersList, with QHttpHeaders. Replace internal usage of raw and cooked header methods with the QHttpHeaders API. [ChangeLog][QtNetwork][QNetworkRequest] Header value added by QNetworkRequest::setRawHeader() method is trimmed now. Task-number: QTBUG-107751 Change-Id: I8882978afa430651e6c798a4fed00beef6c4cfd2 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* SOCKS5: remove '###' from the error messageThiago Macieira12 days1-1/+1
| | | | | | | | There's no reason for it to be there. Pick-to: 6.5 6.7 Change-Id: I262c3499666e4f4fbcfbfffd17cbbcfcd798b100 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Network: cleanlinessMårten Nordheim2024-04-051-1/+1
| | | | | | | | | QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_BYTEARRAY QT_NO_URL_CAST_FROM_STRING Change-Id: Ic77ed8ccbdb146b7e7b26123923795f9748d3a38 Reviewed-by: Mate Barany <mate.barany@qt.io>
* UDP: Protect call to UDP API based on featureMårten Nordheim2024-03-211-1/+5
| | | | | | | | | Fails to compile in some qtlite setup Pick-to: 6.7 6.6 6.5 Change-Id: If04c1ca3f1b4eb59517902b8caab167f4627391b Reviewed-by: Jari Helaakoski <jari.helaakoski@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocalServer: add protected addPendingConnection functionØystein Heskestad2024-03-052-1/+20
| | | | | | | | | | Add addPendingConnection for subclasses to add socket to queue of incoming connection for use with newConnection, hasPendingConnection, and nextPendingConnection. Task-number: QTBUG-75081 Change-Id: Id242a0c3573ee511b403d18af25864add9a3b684 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mention QChronoTimer in API docsAhmad Samir2024-03-031-2/+3
| | | | | Change-Id: Iaf9fb31994f1580b2051dbd0b1b8eef2a218aa39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* UDP: don't disable read notification unless we have a datagramMårten Nordheim2024-03-023-2/+9
| | | | | | | | | | | | | The current logic that we will disable the read notification if we have any data at all doesn't make sense for users who use the receiveDatagram functionality, since they will not make any calls that trigger the read notifier to be re-enabled unless there is a datagram ready for us to hand back. Fixes: QTBUG-105871 Pick-to: 6.7 6.6 6.5 Change-Id: I0a1f1f8babb037d923d1124c2603b1cb466cfe18 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+1
| | | | | | | | | | | | | | | | | | | Clang's `-Wimplicit-fallthrough` warnings are a little stricter than gcc's interpretation: switch (i) { case 0: foo(); case 4: break; } While gcc accepts the implicit fallthrough, if the following statement is a trivial `break`, clang will warn about it. Pick-to: 6.7 Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Containers: add max_size()Giuseppe D'Angelo2024-02-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One more method for STL compatibility. This one is particularly subtle as it's required by the `reservable-container` concept: https://eel.is/c++draft/ranges#range.utility.conv.general-3 Without this concept, ranges::to won't reserve() before copying the elements (out of a sized range which isn't a common_range). Implementation notes: there were already a couple of constants denoting the maximum QByteArray and QString size. Centralize that implementation in QTypedArrayData, so that QList can use it too. The maximum allocation size (private constant) needs a even more central place so that even QVLA can use it. Lacking anything better, I've put it in qcontainerfwd.h. Since our containers aren't allocator-aware, I can make max_size() a static member, and replace the existing constants throughout the rest of qtbase. (I can't kill them yet as they're used by other submodules.) [ChangeLog][QtCore][QList] Added max_size(). [ChangeLog][QtCore][QString] Added max_size(). [ChangeLog][QtCore][QByteArray] Added max_size(). [ChangeLog][QtCore][QVarLengthArray] Added max_size(). Change-Id: I176142e31b998f4f787c96333894b8f6653eb70d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Handle EWOULDBLOCK the same way as EAGAIN when writing to sockets on UnixŁukasz Matysiak2024-01-281-0/+3
| | | | | | | | | | | | | | | On most platforms EWOULDBLOCK is defined to be equal to EAGAIN. However on some platforms (like VxWorks) it is not the case. Because of that, error returned from ::write is not handled properly on such platform. Since C++ does not allow duplicate switch labels, check if EWOULDBLOCK and EAGAIN have different values before adding EWOULDBLOCK to the switch statement. Task-number: QTBUG-115777 Pick-to: 6.7 Change-Id: I659cb946f239733f5c57b2000fb4e3d296ed9153 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Network: Use QHttpHeaders in QHttpHeaderParserLena Biliaieva2024-01-251-1/+2
| | | | | | | | | | | | | QHttpHeaderParser::headers() method is changed to return QHttpHeaders. QAuthenticatorPrivate::parseHttpResponse() method is changed to work with QHttpHeaders. QHttpNetworkHeader::header() method is updated to return QHttpHeaders. Tests are updated. Task-number: QTBUG-120133 Change-Id: I20a18b509acd7a8b8d93884cff8349519d64293e Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* Remove qDeleteInEventHandlerTor Arne Vestbø2023-12-141-3/+3
| | | | | | | | | | It's equivalent to delete these days, and has been for a long time, since 2011 in fact, when the last remnants of QT_JAMBI_BUILD were removed. Change-Id: I7703e41c04204844da4ee75fa251b361e0db4ead Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename EINTR_LOOP -> QT_EINTR_LOOPMarc Mutz2023-11-302-5/+5
| | | | | | | | | | | | | | | This non-namespaced macro was defined in a header, and while that header is private, we shouldn't define non-namespaced macros in our headers. The macro also clashed with one of the same name defined in forkfd.c, which broke unity-builds including the forkfd_qt.cpp TU. This rename fixes that, too, so we can now remove forkfd_qt.cpp from NO_UNITY_BUILD_SOURCES. Pick-to: 6.6 6.5 Change-Id: Ic4bb4e4d7a632ca87905e48913db788a7c202314 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qcore_unix: port qt_safe_poll to QDeadlineTimerAhmad Samir2023-10-243-7/+3
| | | | | | | | | | | | | | | | | | | | | | Remove qt_poll_msecs() since the "forever" state can be simply expressed with a QDeadlineTimer::Forever arg, instead of passing a nullptr timespec, and the negative timeouts treated as "run forever" is also encapsulated by QDealineTimer. Use the QDealineTimer(qint64) constructor in the call sites where the timeout could be negative, so that it creates a Forever timer (the QDeadlineTimer(chrono::duration) constructor uses setRemainingTime(duration) which handles negative timeouts by creating expired timers). Remove qt_gettime() (and do_gettime()). Drive-by changes: - Fix a narrowing conversion warning, qt_make_pollfd() takes an int - Remove an unused include Change-Id: I096319af5e191e28c3d39295fb1aafe9d69841e6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Include what you need: <QPointer>Marc Mutz2023-10-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QLocalSocket: port to QDeadlineTimerAhmad Samir2023-10-071-7/+10
| | | | | | | Easier logic for such use-cases. Change-Id: I4ce14bbaeda5441294f33993195396d9f47710dc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHttpSocketEngine: de-duplicate some codeAhmad Samir2023-10-072-11/+16
| | | | | Change-Id: I4699e3ea0d4687a9772f6f90e6033f5582c1a346 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractSocketEngine: port to QDeadlineTimerAhmad Samir2023-10-0712-124/+134
| | | | | | | | | | | | | | | | 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>
* Fix not emitting proxyAuthenticationRequired signal for NTLMØystein Heskestad2023-10-021-12/+24
| | | | | | | | | | | | | During NTLM http proxy authentication QHttpSocketEngine did not emit the proxyAuthenticationRequired signal during handling of HTTP 407 responses. As a consequence, the proxy server was spammed with connection requests that never worked. Fixes: QTBUG-109718 Pick-to: 6.6 6.5 Change-Id: Icf0ccf58e3f2690d210652713155a303026ed3b1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove obsolete code related to ioctl on vxworksŁukasz Matysiak2023-09-271-5/+0
| | | | | | | | | | | Previous implementation of qt_safe_ioctl mentioned that vxworks defines ioctl in a non-standard way. As of VxWorks 23.03 ioctl is now properly defined so the comment and check in the code are obsolete. Task-number: QTBUG-115777 Change-Id: I0fdf614e45063b031e2c998339d6987ba69167ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNativeSocketEngine: fix build with FreeBSD: sockaddr_dl wasn't declaredThiago Macieira2023-09-261-0/+3
| | | | | | | | | | | This partially reverts fcb548878bfae3db34d482f3ad97074aca76b410. qnativesocketengine_unix.cpp:872:40: error: unknown type name 'sockaddr_dl'; did you mean 'sockaddr_in'? Pick-to: 6.6 Change-Id: Ifeb6206a9fa04424964bfffd178844096ee7741b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qsocks5socketengine: avoid impicit detachAnton Kudryavtsev2023-09-091-1/+1
| | | | | | | by const method usage Change-Id: I0ff04508917a728acec282920df02c667a29e597 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake/Network: limit the testing for some network iface featuresThiago Macieira2023-08-301-13/+0
| | | | | | | | | | | | | | | | | | | | | These features are now only used for qnetworkinterface_unix.cpp, so they aren't needed for Windows or for Linux with AF_NETLINK support. This commit removes the last couple of placess outside of that file where they were used (the qnativesocketengine_unix.cpp code looked stale anyway). These tests cost us approximately 1300 ms during CMake time. This commit does not change that because the tests are checked even if the condition has already been forced OFF by previous conditions. [ChangeLog][Build system] The QT_NO_GETIFADDRS and QT_NO_IPV6IFNAME macros are deprecated. On a standard Linux build, they will be defined to 1, even if the system does support getifaddrs() and ifnametoindex(). Task-number: QTBUG-107248 Task-number: QTBUG-115705 Change-Id: Ifbf974a4d10745b099b1fffd17775822a1a6e55f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAbstractSocket: remove a redundant stack variableAhmad Samir2023-08-031-5/+3
| | | | | | | Just use the static const int directly. Change-Id: Icf37ac5db4457bbc8631659e175d038cfeed46e4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@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>
* QNativeSocketEngine: fix warning about uninitialized variablesThiago Macieira2023-05-311-1/+2
| | | | | | | | | | | | | | In function ‘int qt_safe_connect(int, const sockaddr*, socklen_t)’, inlined from ‘bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress&, quint16) qnet_unix_p.h:111:38: error: ‘sockAddrSize’ may be used uninitialized [-Werror=maybe-uninitialized] qnativesocketengine_unix.cpp:396:18: note: ‘sockAddrSize’ was declared here qnativesocketengine_unix.cpp:476:14: error: ‘aa.qt_sockaddr::a.sockaddr::sa_family’ may be used uninitialized [-Werror=maybe-uninitialized] qnativesocketengine_unix.cpp:471:17: note: ‘aa’ declared here Introduced by commit 45a03fc50662e0977eecf57d62cbe9d8348eb903. Change-Id: I5f7f427ded124479baa6fffd175fbf006c098854 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Network: Fix IFF_UP conflict on Linux with unity buildsMårten Nordheim2023-05-261-0/+4
| | | | | | | | | | | I cannot repro this myself, but from the bug report it seems to be defined in two headers, so we should consistently use the same one. Fixes: QTBUG-113787 Pick-to: 6.5 Change-Id: I9f1cc51e379c33dbbf659946340a5207aaeb448a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QNativeSocketEngine: move some code from the _p_p.h to _p.h fileThiago Macieira2023-05-132-25/+68
| | | | | | | So I can use it in qdnslookup_unix.cpp. Change-Id: I3e3bfef633af4130a03afffd175d506949968990 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove loopback network exampleMårten Nordheim2023-03-232-2/+2
| | | | | | | | | | It doesn't showcase anything interesting that other examples don't already show off. Pick-to: 6.5 Change-Id: Ie95c3ddb3ff52b3beab54bd6fa75fb75ae5c7ba5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
* QObject: implement startTimer(int) in terms of startTimer(chrono)Ahmad Samir2023-03-111-1/+3
| | | | | | | | | | I.e. use chrono first, this means the API isn't limited by the size of int, but by the size of whatever chrono::milliseconds uses (typically int64_t), and chrono units are much more readable as well. Task-number: QTBUG-110059 Change-Id: Ie7f2d90864782361a89866693011803be6f8545e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: fix links to renamed network examplesVolker Hilsheimer2023-03-012-3/+3
| | | | | | Pick-to: 6.5 Change-Id: I8790bb660070a092e268294b5640c6d5af41deb0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork: Split out QNativeSocketEnginePrivateFriedemann Kleint2023-02-025-169/+201
| | | | | | | | | | | 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>
* Fix clang-cl compiler warningsPeter Varga2022-12-152-3/+7
| | | | | | | | | | | | - known but unsupported action 'shared' for '#pragma section' [-Wignored-pragmas] - #include resolved using non-portable Microsoft search rules [-Wmicrosoft-include] - variable is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] Change-Id: I466352ff97a2bcf07e706c045568e581dd08a94e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSctpSocket: Update windows-note to specify 'class'Mårten Nordheim2022-10-262-2/+2
| | | | | | | | | | | | When we say 'this feature', it can be misunderstood to mean the subject of discussion in the immediately preceding paragraph. Pick-to: 6.4 6.2 Fixes: QTBUG-107720 Change-Id: I726c7a591f01e59c3c36c802abeb17b51abf0777 Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Replace usages of Q_CLANG_QDOC with Q_QDOCLuca Di Sera2022-10-215-6/+6
| | | | | | | | | | | | | | | | | | | | | | | To allow the user to customize the C++ code that QDoc sees, so as to be able to work-around some limitations on QDoc itself, QDoc defines two symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an entire execution of QDoc. At a certain point in time, QDoc allowed the user the choice between a custom C++ parser and a Clang based one. The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol would be defined only when the Clang based parser was chosen. In more recent times, QDoc always uses a Clang based parser, such that both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent. To avoid using different symbols, and the possible confusion and fragmentation that derives from it, all usages of Q_CLANG_QDOC are now replaced by the equivalent usages of Q_QDOC. Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-112-2/+2
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-043-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make sockets' accept() methods return qintptrMårten Nordheim2022-08-2410-19/+19
| | | | | | | | | | | 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>
* QSslServer: Make sure maxPendingConnections applies to all socketsMårten Nordheim2022-08-172-1/+16
| | | | | | | | | | Not just the ones we added to the pending sockets list Pick-to: 6.4 Change-Id: I0a0016fe39df7ca2fc3f0c4e4111195bc6d90198 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* The new signal pendingConnectionAvailable is added to QTcpServerØystein Heskestad2022-06-042-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | The new signal pendingConnnectionAvailable is emitted after a new connection has been added to the pending connections queue. Connect to this signal and call nextPendingConnection to handle incoming connections. The existing unchanged newConnection signal is emitted after the overridable function incomingConnection is called, regardless of whether a new connection is added to the pending connections queue in the incomingConnection function or not. If a subclass that overrides incomingConnection either decides to not add all incoming connections to the pending connections queue, or to postpone adding the connection until a handshake is successfully completed, the pendingConnectionAvailable signal should be to used, because this signal directly corresponds to insertions to the pending connections queue. [ChangeLog][QtNetwork][QTcpServer] New signal pendingConnectionAvailable is emitted when a new connection is added Task-number: QTBUG-100823 Change-Id: I00c76761389065f68271553e69e6c45c393a2fa8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* wasm: add support for blocking socketsMorten Johan Sørvig2022-06-021-0/+25
| | | | | | | | | | | | | | | | | | | | | Add support for blocking sockets on secondary threads and on the main thread with asyncify. This extends the support for websockify tunneled TCP sockets, which was previously limited to async sockets on the main thread. Blocking sockets support is implemented by emulating select() on top of emscripten's socket notification support. This is requires synchronization between the blockee threads and the main thread, since we get socket notification callbacks on the main thread. The synchronized state is held in g_socketState where the main thread registers socket readiness state and blocking threads register themselves. Blocking using asyncify on the main thread is similar to blocking on a secondary thread, with the exception that the main thread suspends with qt_asyncify_suspend() instead of waiting on a wait condition. Change-Id: Idb5a493644e1e6634057dc2f64f2e99e82e3c01e Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Use SPDX license identifiersLucie Gérard2022-05-1640-1528/+88
| | | | | | | | | | | | | 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>
* QtNetwork: replace remaining uses of QLatin1String by QLatin1StringViewSona Kurazyan2022-04-212-2/+2
| | | | | | | Task-number: QTBUG-98434 Change-Id: I0bb9d534ee42ccbf7d353e251ef58901a86923b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-2111-109/+118
| | | | | | Task-number: QTBUG-98434 Change-Id: Ic235b92377203f7a1429ae7fd784c4a1fa893e9f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-214-10/+10
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I121f87214b77aeab1dfd3e62dc5adaa6255cc0e0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtNetwork: sweep Q_DECLARE_METATYPE → QT_DECL_METATYPE_EXTERN [1/2]: ↵Marc Mutz2022-04-052-2/+7
| | | | | | | | | | | | | | public API It's one of our best tools to improve compile times. Can't backport to Qt 6.3 or 6.2 because this change introduces new exported symbols. Task-number: QTBUG-102206 Change-Id: I6bfa532be34ca847d3b9034d16c94efed3d602c3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* 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>
* Misc: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+1
| | | | | | | | As a drive-by, remove superfluous includes from qnetworkmanagerservice.h and obey the coding conventions for includes in a few more places. Change-Id: I65b68c0cef7598d06a125e97637040392d4be9ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractSocket: update setSocketOption documentationMårten Nordheim2022-03-081-0/+4
| | | | | | | | | | | | | | | | | Specify that it should not be called until the internal socket engine has been created. Given that most usages of this function will be on QUdpSockets and that people will likely want to call bind() on those anyway, we just document this rather than implement some caching mechanism. Pick-to: 6.3 6.2 Fixes: QTBUG-67576 Change-Id: Ia5d3ade95460b7c5685681ee098f1c00bff43a90 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix deprecated uses of QScopedPointerMårten Nordheim2022-03-081-2/+4
| | | | | | | | | By changing it to unique_ptr. Pick-to: 6.2 6.3 Change-Id: I91abb69445b537d4c95983ae735341882352b29d Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>