Obsolete ReceiveBufferSize in WebSocketOptions #20084 (#20189)

* Obsolete ReceiveBufferSize in WebSocketOptions

* Update reference

* Update obsolete messages
This commit is contained in:
huysentruitw 2020-03-26 19:02:30 +01:00 committed by GitHub
parent e21fb7e93c
commit bb2e2a9160
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -13,6 +13,7 @@ namespace Microsoft.AspNetCore.Builder
public WebSocketOptions() { } public WebSocketOptions() { }
public System.Collections.Generic.IList<string> AllowedOrigins { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } public System.Collections.Generic.IList<string> AllowedOrigins { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.TimeSpan KeepAliveInterval { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public System.TimeSpan KeepAliveInterval { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[System.ObsoleteAttribute("Setting this property has no effect. It will be removed in a future version.")]
public int ReceiveBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public int ReceiveBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
} }
} }
@ -22,6 +23,7 @@ namespace Microsoft.AspNetCore.WebSockets
{ {
public ExtendedWebSocketAcceptContext() { } public ExtendedWebSocketAcceptContext() { }
public System.TimeSpan? KeepAliveInterval { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public System.TimeSpan? KeepAliveInterval { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[System.ObsoleteAttribute("Setting this property has no effect. It will be removed in a future version.")]
public int? ReceiveBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public int? ReceiveBufferSize { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public override string SubProtocol { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public override string SubProtocol { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
} }

View File

@ -9,7 +9,10 @@ namespace Microsoft.AspNetCore.WebSockets
public class ExtendedWebSocketAcceptContext : WebSocketAcceptContext public class ExtendedWebSocketAcceptContext : WebSocketAcceptContext
{ {
public override string SubProtocol { get; set; } public override string SubProtocol { get; set; }
[Obsolete("Setting this property has no effect. It will be removed in a future version.")]
public int? ReceiveBufferSize { get; set; } public int? ReceiveBufferSize { get; set; }
public TimeSpan? KeepAliveInterval { get; set; } public TimeSpan? KeepAliveInterval { get; set; }
} }
} }

View File

@ -131,14 +131,9 @@ namespace Microsoft.AspNetCore.WebSockets
} }
TimeSpan keepAliveInterval = _options.KeepAliveInterval; TimeSpan keepAliveInterval = _options.KeepAliveInterval;
int receiveBufferSize = _options.ReceiveBufferSize;
var advancedAcceptContext = acceptContext as ExtendedWebSocketAcceptContext; var advancedAcceptContext = acceptContext as ExtendedWebSocketAcceptContext;
if (advancedAcceptContext != null) if (advancedAcceptContext != null)
{ {
if (advancedAcceptContext.ReceiveBufferSize.HasValue)
{
receiveBufferSize = advancedAcceptContext.ReceiveBufferSize.Value;
}
if (advancedAcceptContext.KeepAliveInterval.HasValue) if (advancedAcceptContext.KeepAliveInterval.HasValue)
{ {
keepAliveInterval = advancedAcceptContext.KeepAliveInterval.Value; keepAliveInterval = advancedAcceptContext.KeepAliveInterval.Value;

View File

@ -14,7 +14,6 @@ namespace Microsoft.AspNetCore.Builder
public WebSocketOptions() public WebSocketOptions()
{ {
KeepAliveInterval = TimeSpan.FromMinutes(2); KeepAliveInterval = TimeSpan.FromMinutes(2);
ReceiveBufferSize = 4 * 1024;
AllowedOrigins = new List<string>(); AllowedOrigins = new List<string>();
} }
@ -28,6 +27,7 @@ namespace Microsoft.AspNetCore.Builder
/// Gets or sets the size of the protocol buffer used to receive and parse frames. /// Gets or sets the size of the protocol buffer used to receive and parse frames.
/// The default is 4kb. /// The default is 4kb.
/// </summary> /// </summary>
[Obsolete("Setting this property has no effect. It will be removed in a future version.")]
public int ReceiveBufferSize { get; set; } public int ReceiveBufferSize { get; set; }
/// <summary> /// <summary>
@ -36,4 +36,4 @@ namespace Microsoft.AspNetCore.Builder
/// </summary> /// </summary>
public IList<string> AllowedOrigins { get; } public IList<string> AllowedOrigins { get; }
} }
} }