summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access/http2/http2srv.h
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2018-05-23 09:31:34 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2018-06-04 13:38:04 +0000
commita217188fe054ca0aaa34c8e12ce99f276fe7eb7c (patch)
tree6e1540bd886211e2af2ccac17675521ec775bf71 /tests/auto/network/access/http2/http2srv.h
parent04b180f7f25d73d002df31085cf1c352e075d4e5 (diff)
tst_Http2 auto-test: stop sending DATA frames if test failed
Unlike QNAM, our toy http2 server sends payload as one big chunk as soon as it fits in the receive window's size. Internally, 'frame writer' splits this payload into many DATA frames of the appropriate size (imposed either by the default value or the one from the client's SETTINGS frame). If some test fails, we can end up with a server waiting for the writer to send all the DATA frames though it is not needed anymore - there is nobody to receive them after a failure. This patch moves such a loop into the test server instead and stops the loop early if needed. Change-Id: Iea2dcd718d8f83386fd16004807f6447bf999435 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/network/access/http2/http2srv.h')
-rw-r--r--tests/auto/network/access/http2/http2srv.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/network/access/http2/http2srv.h b/tests/auto/network/access/http2/http2srv.h
index 14b41cc67d..87a17ced8b 100644
--- a/tests/auto/network/access/http2/http2srv.h
+++ b/tests/auto/network/access/http2/http2srv.h
@@ -40,6 +40,7 @@
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qtcpserver.h>
#include <QtCore/qbytearray.h>
+#include <QtCore/qatomic.h>
#include <QtCore/qglobal.h>
#include <vector>
@@ -96,6 +97,8 @@ public:
Q_INVOKABLE void sendResponse(quint32 streamID, bool emptyBody);
+ void stopSendingDATAFrames();
+
private:
void processRequest();
@@ -191,6 +194,7 @@ private:
// may still be sending DATA frames. See tst_Http2::earlyResponse().
bool redirectWhileReading = false;
quint16 targetPort = 0;
+ QAtomicInt interrupted;
protected slots:
void ignoreErrorSlot();
};