summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnativesocketengine_winrt_p.h
Commit message (Collapse)AuthorAgeFilesLines
* winrt: Do not lose initial data for TCP connectionsOliver Wolff2016-10-141-1/+1
| | | | | | | | | | | | | | | | | When a client connects and sends data immediately it was possible that initial data was lost as the state was set too late. If the callback was called before the state was set the socket engine just discarded the data. So the state has to be set before the callback is registered. The new implementation needs a list of pending read operations. It can happen that the "readyRead" callback is triggered directly while "put_Completed" is called. The callback reassigns readOp which causes a "function not implemented" exception when it jumps back to the "put_Completed" call in "initialize" Task-number: QTBUG-55889 Change-Id: I5f52e3377b6176f1f90f227ac0bf52b60ee2d95a Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* winrt: tcpsocket: Update bytesAvailable when new data is readHarald Meyer2016-10-121-0/+2
| | | | | | | | | | | | | | Instead of calculating the bytesAvailable in place, the value should be stored and only retrieved in the function itself. Otherwise it is possible that bytesAvailable is called between the data having been read and readyRead is emitted. In this case it's possible, that the client reads all the data before the signal is emitted. Triggering readyRead without any data being available will stop the socket. Task-number: QTBUG-44357 Change-Id: I81d6ab094c5fdd71f30b9ceba9d790153cc92439 Reviewed-by: Harald Meyer <dev@meh.at> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* winrt: Rework handling of udp datagramsOliver Wolff2016-10-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We may only emit the readReady signal once for every event loop iteration. The previous implementation lead to the situation that the socket engine stopped reading socket data when bursts of data was received. In this case several readReady signals were fired. The socket engine obtained the pending datagrams (not only the first one) and for the following readReady signal no datagram was present. In this case the socket engine stops reading and the engine stalls. The new approach emits the readyRead signal at the most once every event loop iteration. The list of new pending datagrams is queued to be added to the "real" pending datagram list at the same time as the readyRead signal. Thereby we avoid the situation that a client can read all the datagrams before readyRead is emitted. One more advantage of having the worker handle the pending datagrams is that we no longer have to access the socket engine's members inside the callback. Thus we avoid the situation, where a late callback can make the application crash when the socket engine has already been deleted. Task-number: QTBUG-53472 Task-number: QTBUG-53471 Task-number: QTBUG-55895 Change-Id: Ia6d21cb635a40e7bd9e0213bb3a5c54ebc1220eb Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Add qtnetworkglobal.h and qtnetworkglobal_p.hLars Knoll2016-07-031-0/+2
| | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. That header will later on #include the configuration file for Qt Network. For now it defines the Q_NETWORK_EXPORT macro for this library. Change-Id: I9c45d425baf881c431ed71fd457c7feb2c123855 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-061-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| * WinRT: Rename connectToHost/handleConnectionEstablishedOliver Wolff2016-06-041-2/+1
| | | | | | | | | | | | | | | | | | | | The two functions are merged and also renamed. handleConnectionEstablished indicates that the operation succeeded, but that is not necessarily the case. Change-Id: I66a4181a5693353fc9507785a6e6bbb8d5300a4b Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
| * winrt: Fix potential crash when reading closed socketsMaurice Kalinowski2016-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using multiple concurrent requests can cause a delay between a socket closing and getting deleted. At that point the state was closingDown, but not wasDeleted yet. Especially on slower arm devices, callbacks are done from another thread causing synchronization issues. Hence closingDown needs to be synced and handleReadyRead needs to have more criterias to return early to avoid invalid access crashes. Easiest to reproduce is heavy scrolling on the mapviewer example when it downloads a huge amount of tiles and cancels those requests when not in view anymore. Change-Id: I442b6243bbefb3af938b6b1b3739a6a85b4887c0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-251-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test configure src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java src/corelib/global/qglobal.cpp src/widgets/kernel/qapplication.cpp src/widgets/styles/qwindowsvistastyle.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp Change-Id: I067083f34e5290aa5f7565e40c30a069cc37b83a
| * WinRT: Removed superfluous callback that handles completed bindsOliver Wolff2016-04-131-1/+0
| | | | | | | | | | | | | | | | | | | | The callback was added as the functionality did not work as expected on Windows 8. The behavior seems to have been fixed so that the callback is no longer needed and can be removed. Change-Id: I3def5750271e40eea1c6a88eed693f4da4ea44bb Reviewed-by: Samuel Nevala <samuel.nevala@intopalo.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
| * winrt: Cancel pending read operations before tcp sockets are closedOliver Wolff2016-04-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the documentation tcp sockets are closed properly if their instances are deleted when no read operation is pending. Thus we have to keep track of the running read operation, cancel it (only available on Windows 10) and delete it before closing the socket. As there is no way to cancel the read operation on Windows 8.1 the hard reset still happens there. Change-Id: Idc75178f7d05057b610ac7000e95486d6a52cb85 Reviewed-by: Samuel Nevala <samuel.nevala@intopalo.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Align signature with generic native socket engineMaurice Kalinowski2015-12-091-1/+1
| | | | | | | | | | This allows to use readDatagram on WinRT like on any other platform, ie using two arguments. Fixes compilation in auto-tests. Change-Id: I4a6e34dc72d2845faab9067ce67800d8b386c344 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-1/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * WinRT: Unregister callbacks when socket engine is destroyedOliver Wolff2015-09-031-0/+1
| | | | | | | | | | Change-Id: I66e8fff2556ce23a66db1148bdb68e9a448227b2 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
| * Fixed connectToHostOliver Wolff2015-09-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | connectToHost is not meant to be synchronous, but waitForWrite is used internally to wait for the connection to be established. Thus the same logic that is used in the callback has to be applied in there. Task-number: QTBUG-46339 Change-Id: Ia1fb5c1ae609a9942ff4d8fe2f5fab2ef572da0c Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
* | QAbstractSocketEngine: introduce QIpPacketHeader for datagramsThiago Macieira2015-08-221-6/+3
|/ | | | | | | | | | | | | | | | | | | This commit changes the readDatagram() and writeDatagram() virtual functions to take a QIpPacketHeader as meta data, instead of a QHostAddress/quint16 pair. As previously, the header is an "out" parameter for readDatagram() and an "in" parameter for writeDatagram(). The header pointer in readDatagram() is allowed to be null if the PacketHeaderOptions indicates WantNone. Otherwise, it must not be null. The extra options parameter is introduced because we may not always want all the metadata upon reception. For sending, we know what to include or not based on what's set in the incoming header parameter. QIpPacketHeader splits sender and destination because we'll be able to return both on datagram reception. Change-Id: Iee8cbc07c4434ce9b560ffff13ca4213255008c7 Reviewed-by: Richard J. Moore <rich@kde.org>
* winrt: Fixed connectToHost, which is meant to be synchronousOliver Wolff2015-06-221-1/+1
| | | | | | Task-number: QTBUG-46339 Change-Id: I413fef39424a0815ef4604000f85ad37ac2b4dc2 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
* WinRT: Windows 10 compilation fixMaurice Kalinowski2015-05-221-0/+1
| | | | | | | Header is required for successful compilation. Change-Id: I401b7c6fbc594b3cd0c9a4b25afc8ff918d8bddd Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* WinRT: Fill data in QUdpSocket::readDatagramOliver Wolff2014-11-161-1/+8
| | | | | | | | | | There was still a TODO left in there and the data was never filled. In addition to filling the data, some pointer checks for addr and port were added. Task-number: QTBUG-42244 Change-Id: I8e358b5544edcdb4077a52f433e4bc17d92014ce Reviewed-by: Andrew Knight <andrew.knight@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* winrt: Refactor internal socket bufferAndrew Knight2014-08-281-2/+0
| | | | | | | | Simplify the temporary buffer usage by using the built-in WinRT Buffer class. This also allows one use of the local event loop to be removed. Change-Id: Ice552910227ffbe31c6e8716ff7896af7c4532ef Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
* winrt: Fix socket descriptor storage in native socket engineAndrew Knight2014-08-281-2/+10
| | | | | | | | | | | | | This stores the socket pointer in the descriptor, rather than an abitrary handle, so that it is easier to access from e.g. SSL socket. To further support SSL sockets, a special case for SSL sockets is made so that the the socket reader installation can be delayed until after the socket is encrypted (as this is the only supported mode of operation with StreamSocket). Change-Id: I693229189722dc43b221b167e8256f5497a50346 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
* winrt: use ComPtr in network classesAndrew Knight2014-06-251-4/+2
| | | | | | | | | | This removes extra code and potential memory leaks by using smart pointers instead of calling Release() directly. Task-number: QTBUG-38115 Change-Id: If799d6948af8c3df3d0c1617742653b104087e3b Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* WinRT: Fix TCP socket readsAndrew Knight2014-04-221-3/+15
| | | | | | | | | | | | All read calls are now pulled from an intermediate buffer which is populated from the asynchronous callback (this was a TODO previously, and was breaking downloads of large requests). As a side-benefit, the use of only async callbacks ensures fewer first-chance exceptions appear in the debug output. Task-number: QTBUG-30196 Change-Id: I5653742d8d94934a4b4a4227298865d20518bc4c Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* WinRT: Added socket engine implementationOliver Wolff2014-02-151-0/+64
| | | | | | | | | | Added basic functionality to socket for WinRT. Even though not all auto tests pass yet, this patch can be seen as a foundation for upcoming work in this area. Reading from and writing to TCP socket works and one can listen for tcp connections. Change-Id: Id4c25ba1c7187ed92b6368c785c4f62837faded7 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* WinRT: Added networkinterface and hostinfoOliver Wolff2013-12-061-0/+145
While QHostInfo and QNetworkInterface are implemented, socket implementation is just a stub for now. Having stub implementation is preferable over not having them at all is because most applications will not build, if sockets are not available. Even though they do not do anything useful yet, applications can be compiled and run to get an idea how network will work on WinRT. Change-Id: I78ea88901a30280d4098b75ef7398c2628dd19c8 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>