Skip to content

Commit a96a7d4

Browse files
committed
Rename KeepAlivePingInterval to KeepAlivePingDelay
1 parent b094ecd commit a96a7d4

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

src/Servers/Kestrel/Core/src/Http2Limits.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class Http2Limits
1919
private int _maxRequestHeaderFieldSize = (int)Http2PeerSettings.DefaultMaxFrameSize;
2020
private int _initialConnectionWindowSize = 1024 * 128; // Larger than the default 64kb, and larger than any one single stream.
2121
private int _initialStreamWindowSize = 1024 * 96; // Larger than the default 64kb
22-
private TimeSpan _keepAlivePingInterval = TimeSpan.MaxValue;
22+
private TimeSpan _keepAlivePingDelay = TimeSpan.MaxValue;
2323
private TimeSpan _keepAlivePingTimeout = TimeSpan.FromSeconds(20);
2424

2525
/// <summary>
@@ -147,18 +147,18 @@ public int InitialStreamWindowSize
147147
}
148148

149149
/// <summary>
150-
/// Gets or sets the keep alive ping interval. The server will send a keep alive ping to the client if it
151-
/// doesn't receive any frames for this period of time. This property is used together with
150+
/// Gets or sets the keep alive ping delay. The server will send a keep alive ping to the client if it
151+
/// doesn't receive any frames on a connection for this period of time. This property is used together with
152152
/// <see cref="KeepAlivePingTimeout"/> to close broken connections.
153153
/// <para>
154-
/// Interval must be greater than or equal to 1 second. Set to <see cref="TimeSpan.MaxValue"/> to
155-
/// disable the keep alive ping interval.
154+
/// Delay value must be greater than or equal to 1 second. Set to <see cref="TimeSpan.MaxValue"/> to
155+
/// disable the keep alive ping.
156156
/// Defaults to <see cref="TimeSpan.MaxValue"/>.
157157
/// </para>
158158
/// </summary>
159-
public TimeSpan KeepAlivePingInterval
159+
public TimeSpan KeepAlivePingDelay
160160
{
161-
get => _keepAlivePingInterval;
161+
get => _keepAlivePingDelay;
162162
set
163163
{
164164
// Keep alive uses Kestrel's system clock which has a 1 second resolution. Time is greater or equal to clock resolution.
@@ -167,13 +167,13 @@ public TimeSpan KeepAlivePingInterval
167167
throw new ArgumentOutOfRangeException(nameof(value), CoreStrings.FormatArgumentTimeSpanGreaterOrEqual(Heartbeat.Interval));
168168
}
169169

170-
_keepAlivePingInterval = value != Timeout.InfiniteTimeSpan ? value : TimeSpan.MaxValue;
170+
_keepAlivePingDelay = value != Timeout.InfiniteTimeSpan ? value : TimeSpan.MaxValue;
171171
}
172172
}
173173

174174
/// <summary>
175175
/// Gets or sets the keep alive ping timeout. Keep alive pings are sent when a period of inactivity exceeds
176-
/// the configured <see cref="KeepAlivePingInterval"/> value. The server will close the connection if it
176+
/// the configured <see cref="KeepAlivePingDelay"/> value. The server will close the connection if it
177177
/// doesn't receive any frames within the timeout.
178178
/// <para>
179179
/// Timeout must be greater than or equal to 1 second. Set to <see cref="TimeSpan.MaxValue"/> to

src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ public Http2Connection(HttpConnectionContext context)
107107
var connectionWindow = (uint)http2Limits.InitialConnectionWindowSize;
108108
_inputFlowControl = new InputFlowControl(connectionWindow, connectionWindow / 2);
109109

110-
if (http2Limits.KeepAlivePingInterval != TimeSpan.MaxValue)
110+
if (http2Limits.KeepAlivePingDelay != TimeSpan.MaxValue)
111111
{
112112
_keepAlive = new Http2KeepAlive(
113-
http2Limits.KeepAlivePingInterval,
113+
http2Limits.KeepAlivePingDelay,
114114
http2Limits.KeepAlivePingTimeout,
115115
context.ServiceContext.SystemClock);
116116
}

src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2KeepAliveTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests
1212
public class Http2KeepAliveTests : Http2TestBase
1313
{
1414
[Fact]
15-
public async Task KeepAlivePingInterval_InfiniteTimeSpan_KeepAliveNotEnabled()
15+
public async Task KeepAlivePingDelay_InfiniteTimeSpan_KeepAliveNotEnabled()
1616
{
17-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = Timeout.InfiniteTimeSpan;
17+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = Timeout.InfiniteTimeSpan;
1818

1919
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
2020

@@ -26,7 +26,7 @@ public async Task KeepAlivePingInterval_InfiniteTimeSpan_KeepAliveNotEnabled()
2626
[Fact]
2727
public async Task KeepAlivePingTimeout_InfiniteTimeSpan_NoGoAway()
2828
{
29-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
29+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
3030
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = Timeout.InfiniteTimeSpan;
3131

3232
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
@@ -57,7 +57,7 @@ await ExpectAsync(Http2FrameType.PING,
5757
[Fact]
5858
public async Task IntervalExceeded_WithoutActivity_PingSent()
5959
{
60-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
60+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
6161

6262
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
6363

@@ -80,7 +80,7 @@ await ExpectAsync(Http2FrameType.PING,
8080
[Fact]
8181
public async Task IntervalExceeded_WithActivity_NoPingSent()
8282
{
83-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
83+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
8484

8585
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
8686

@@ -104,7 +104,7 @@ await ExpectAsync(Http2FrameType.PING,
104104
[Fact]
105105
public async Task IntervalNotExceeded_NoPingSent()
106106
{
107-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(5);
107+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(5);
108108

109109
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
110110

@@ -122,7 +122,7 @@ public async Task IntervalNotExceeded_NoPingSent()
122122
[Fact]
123123
public async Task IntervalExceeded_MultipleTimes_PingsNotSentWhileAwaitingOnAck()
124124
{
125-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
125+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
126126

127127
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
128128

@@ -146,7 +146,7 @@ await ExpectAsync(Http2FrameType.PING,
146146
[Fact]
147147
public async Task IntervalExceeded_MultipleTimes_PingSentAfterAck()
148148
{
149-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
149+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
150150

151151
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
152152

@@ -185,7 +185,7 @@ await ExpectAsync(Http2FrameType.PING,
185185
[Fact]
186186
public async Task TimeoutExceeded_NoAck_GoAway()
187187
{
188-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
188+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
189189
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(3);
190190

191191
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
@@ -217,7 +217,7 @@ await ExpectAsync(Http2FrameType.PING,
217217
[Fact]
218218
public async Task TimeoutExceeded_NonPingActivity_NoGoAway()
219219
{
220-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
220+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
221221
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(3);
222222

223223
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
@@ -250,7 +250,7 @@ await ExpectAsync(Http2FrameType.HEADERS,
250250
[Fact]
251251
public async Task IntervalExceeded_StreamStarted_NoPingSent()
252252
{
253-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
253+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
254254

255255
await InitializeConnectionAsync(_noopApplication).DefaultTimeout();
256256

@@ -275,7 +275,7 @@ await ExpectAsync(Http2FrameType.HEADERS,
275275
[Fact]
276276
public async Task IntervalExceeded_ConnectionFlowControlUsedUpThenPings_NoPingSent()
277277
{
278-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
278+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
279279

280280
// Reduce connection window size so that one stream can fill it
281281
_serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize = 65535;
@@ -330,7 +330,7 @@ await ExpectAsync(Http2FrameType.HEADERS,
330330
[Fact]
331331
public async Task TimeoutExceeded_ConnectionFlowControlUsedUpThenPings_NoGoAway()
332332
{
333-
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(1);
333+
_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1);
334334

335335
// Reduce connection window size so that one stream can fill it
336336
_serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize = 65535;

0 commit comments

Comments
 (0)