Skip to content

Commit

Permalink
Allow to set the max by config
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Jan 7, 2020
1 parent 67b962c commit ab43e2e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions neo/Network/RPC/RpcServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ public sealed class RpcServer : IDisposable
{
public Wallet Wallet { get; set; }
public Fixed8 MaxGasInvoke { get; }
public int MaxConcurrentConnections { get; }

private IWebHost host;
private readonly NeoSystem system;

public RpcServer(NeoSystem system, Wallet wallet = null, Fixed8 maxGasInvoke = default(Fixed8))
public RpcServer(NeoSystem system, Wallet wallet = null, Fixed8 maxGasInvoke = default(Fixed8), int maxConcurrentConnections = Peer.DefaultMaxConnections)
{
this.system = system;
this.Wallet = wallet;
this.MaxGasInvoke = maxGasInvoke;
this.MaxConcurrentConnections = maxConcurrentConnections;
}

private static JObject CreateErrorResponse(JObject id, int code, string message, JObject data = null)
Expand Down Expand Up @@ -362,7 +364,7 @@ public void Start(IPAddress bindAddress, int port, string sslCert = null, string
host = new WebHostBuilder().UseKestrel(options => options.Listen(bindAddress, port, listenOptions =>
{
// Default value is unlimited
options.Limits.MaxConcurrentConnections = Peer.DefaultMaxConnections;
options.Limits.MaxConcurrentConnections = MaxConcurrentConnections;
// Default value is 2 minutes
options.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(1);
// Default value is 30 seconds
Expand Down

0 comments on commit ab43e2e

Please sign in to comment.