From 078c71ac8f0c74e06e0d81ea1a5a44126abc27b6 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Tue, 22 Apr 2014 12:43:28 +0300 Subject: WinRT: Fix TCP socket reads 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 --- src/network/socket/qnativesocketengine_winrt_p.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/network/socket/qnativesocketengine_winrt_p.h') diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h index b5be5fa830..ec2e1b3ad4 100644 --- a/src/network/socket/qnativesocketengine_winrt_p.h +++ b/src/network/socket/qnativesocketengine_winrt_p.h @@ -52,6 +52,8 @@ // // We mean it. // +#include +#include #include "QtNetwork/qhostaddress.h" #include "private/qabstractsocketengine_p.h" #include @@ -127,6 +129,11 @@ public: bool isExceptionNotificationEnabled() const; void setExceptionNotificationEnabled(bool enable); +signals: + void connectionReady(); + void readReady(); + void writeReady(); + private: Q_DECLARE_PRIVATE(QNativeSocketEngine) Q_DISABLE_COPY(QNativeSocketEngine) @@ -191,17 +198,22 @@ private: ABI::Windows::Networking::Sockets::IDatagramSocket *udp; }; Microsoft::WRL::ComPtr tcpListener; - Microsoft::WRL::ComPtr inputBuffer; + Microsoft::WRL::ComPtr readBuffer; + QBuffer readBytes; + QMutex readMutex; QList pendingDatagrams; QList pendingConnections; QList currentConnections; + QEventLoop eventLoop; + HRESULT handleBindCompleted(ABI::Windows::Foundation::IAsyncAction *, ABI::Windows::Foundation::AsyncStatus); HRESULT handleNewDatagram(ABI::Windows::Networking::Sockets::IDatagramSocket *socket, ABI::Windows::Networking::Sockets::IDatagramSocketMessageReceivedEventArgs *args); HRESULT handleClientConnection(ABI::Windows::Networking::Sockets::IStreamSocketListener *tcpListener, ABI::Windows::Networking::Sockets::IStreamSocketListenerConnectionReceivedEventArgs *args); - static HRESULT interruptEventDispatcher(ABI::Windows::Foundation::IAsyncAction *, ABI::Windows::Foundation::AsyncStatus); - static HRESULT handleReadyRead(ABI::Windows::Foundation::IAsyncOperationWithProgress *asyncInfo, ABI::Windows::Foundation::AsyncStatus); + HRESULT handleConnectToHost(ABI::Windows::Foundation::IAsyncAction *, ABI::Windows::Foundation::AsyncStatus); + HRESULT handleReadyRead(ABI::Windows::Foundation::IAsyncOperationWithProgress *asyncInfo, ABI::Windows::Foundation::AsyncStatus); + HRESULT handleWriteCompleted(ABI::Windows::Foundation::IAsyncOperationWithProgress *, ABI::Windows::Foundation::AsyncStatus); }; QT_END_NAMESPACE -- cgit v1.2.3