summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnativesocketengine_winrt_p.h
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2016-11-01 14:48:16 +0100
committerOliver Wolff <oliver.wolff@qt.io>2016-11-03 09:28:16 +0000
commite1f29814daf1ea81b05cc95cc5d187eea362af67 (patch)
treed19bfe10565bf0423d549a7393364cd68dce9693 /src/network/socket/qnativesocketengine_winrt_p.h
parent71166288cb71b58eb7a84b70e92a10396cdf9ee4 (diff)
winrt: Proper guarding by readMutex
Commented its purpose and the guarded members for readMutex. Fixed places where guarded members were accessed without using the mutex. Use QMutexLocker instead of manually (un-)locking the mutex. Task-number: QTBUG-44357 Change-Id: I0d46f9592d5a9d1b52e73df961785a6f6c9e80be Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/network/socket/qnativesocketengine_winrt_p.h')
-rw-r--r--src/network/socket/qnativesocketengine_winrt_p.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h
index 79530d57f1..c9a67ca5f4 100644
--- a/src/network/socket/qnativesocketengine_winrt_p.h
+++ b/src/network/socket/qnativesocketengine_winrt_p.h
@@ -215,12 +215,23 @@ private:
Microsoft::WRL::ComPtr<ABI::Windows::Networking::Sockets::IStreamSocketListener> tcpListener;
Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncAction> connectOp;
QVector<Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncOperationWithProgress<ABI::Windows::Storage::Streams::IBuffer *, UINT32>>> pendingReadOps;
+
+ // Protected by readMutex. Written in handleReadyRead (native callback)
QBuffer readBytes;
- QMutex readMutex;
+
+ // In case of TCP readMutex protects readBytes and bytesAvailable. In case of UDP it is
+ // pendingDatagrams. They are written inside native callbacks (handleReadyRead and
+ // handleNewDatagrams/putIntoPendingDatagramsList)
+ mutable QMutex readMutex;
+
bool emitOnNewDatagram;
+
+ // Protected by readMutex. Written in handleReadyRead (native callback)
QAtomicInteger<int> bytesAvailable;
+ // Protected by readMutex. Written in handleNewDatagrams/putIntoPendingDatagramsList
QList<WinRtDatagram> pendingDatagrams;
+
QList<ABI::Windows::Networking::Sockets::IStreamSocket *> pendingConnections;
QList<ABI::Windows::Networking::Sockets::IStreamSocket *> currentConnections;
QEventLoop eventLoop;