aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2025-03-26 13:48:47 +0100
committerLoïc Hoguin <[email protected]>2025-03-26 13:48:47 +0100
commitd94b9fa9edacd550af6ae12b3be9be213c78bf98 (patch)
tree5c3f068da9e75897c517c0a671f79669a2a3587e /src
parentaae43c5a6cfd0cba7835a3e739a7d7e9cf1cad14 (diff)
downloadgun-d94b9fa9edacd550af6ae12b3be9be213c78bf98.tar.gz
gun-d94b9fa9edacd550af6ae12b3be9be213c78bf98.tar.bz2
gun-d94b9fa9edacd550af6ae12b3be9be213c78bf98.zip
User ping payload is 10000 or above
Diffstat (limited to 'src')
-rw-r--r--src/gun_http2.erl7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gun_http2.erl b/src/gun_http2.erl
index a1d717e..a10fe44 100644
--- a/src/gun_http2.erl
+++ b/src/gun_http2.erl
@@ -972,8 +972,11 @@ keepalive(State=#http2_state{socket=Socket, transport=Transport, pings_unack=Pin
ping(State=#http2_state{socket=Socket, transport=Transport, user_pings=UserPings},
undefined, ReplyTo, PingRef) ->
- %% Use non-zero 64-bit payload for user pings. 0 is reserved for keepalive.
- Payload = erlang:unique_integer([monotonic, positive]),
+ %% User pings use the 64-bit payload for identification.
+ %% The payload 0 is already used for keepalive, and payloads
+ %% 1 through 9999 are reserved for future use. Payloads 10000
+ %% and above are used by user pings.
+ Payload = 9999 + erlang:unique_integer([monotonic, positive]),
case Transport:send(Socket, cow_http2:ping(Payload)) of
ok ->
UserPing = #user_ping{ref = PingRef, reply_to = ReplyTo, payload = Payload},