[master] 782e07a Implement PING frames

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 5 11:07:12 CEST 2016


commit 782e07a19ee5be7b1a7d1f10e02033f42bb75ff2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 5 09:05:53 2016 +0000

    Implement PING frames

diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 4175367..6c69558 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -111,7 +111,6 @@ static const uint8_t H2_settings[] = {
 
 DUMMY_FRAME(data)
 DUMMY_FRAME(rst_stream)
-DUMMY_FRAME(ping)
 DUMMY_FRAME(push_promise)
 DUMMY_FRAME(continuation)
 
@@ -289,6 +288,20 @@ h2_vsl_frame(const struct h2_sess *h2, const void *ptr, size_t len)
  */
 
 void __match_proto__(h2_frame_f)
+h2_rx_ping(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
+{
+	(void)r2;
+	xxxassert(h2->rxf_len == 8);
+	xxxassert(h2->rxf_flags == 0);
+	xxxassert(h2->rxf_stream == 0);
+	H2_Send_Frame(wrk, h2,
+	    H2_FRAME_PING, H2FF_PING_ACK, 8, 0, h2->rxf_data);
+}
+
+/**********************************************************************
+ */
+
+void __match_proto__(h2_frame_f)
 h2_rx_goaway(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
 {
 	uint32_t	error;
diff --git a/bin/varnishtest/tests/t02000.vtc b/bin/varnishtest/tests/t02000.vtc
index 74e9f3b..f1343ec 100644
--- a/bin/varnishtest/tests/t02000.vtc
+++ b/bin/varnishtest/tests/t02000.vtc
@@ -15,4 +15,10 @@ client c1 {
 		txreq
 		rxresp
 	} -run
+	stream 0 {
+		txping -data "_-__-_-_"
+		rxping
+		expect ping.ack == "true"
+		expect ping.data == "_-__-_-_"
+	} -run
 } -run



More information about the varnish-commit mailing list