diff --git a/src/RpcServer/RpcServer.cs b/src/RpcServer/RpcServer.cs index 91280c699..ee027543e 100644 --- a/src/RpcServer/RpcServer.cs +++ b/src/RpcServer/RpcServer.cs @@ -92,7 +92,7 @@ protected override void OnPluginsLoaded() host = new WebHostBuilder().UseKestrel(options => options.Listen(Settings.Default.BindAddress, Settings.Default.Port, listenOptions => { // Default value is unlimited - options.Limits.MaxConcurrentConnections = Peer.DefaultMaxConnections; + options.Limits.MaxConcurrentConnections = Settings.Default.MaxConcurrentConnections; // Default value is 2 minutes options.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(1); // Default value is 30 seconds diff --git a/src/RpcServer/RpcServer/config.json b/src/RpcServer/RpcServer/config.json index 39d4639c0..d51daac31 100644 --- a/src/RpcServer/RpcServer/config.json +++ b/src/RpcServer/RpcServer/config.json @@ -9,6 +9,7 @@ "RpcPass": "", "MaxGasInvoke": 10, "MaxFee": 0.1, + "MaxConcurrentConnections": 40, "DisabledMethods": [ "openwallet" ] } } diff --git a/src/RpcServer/Settings.cs b/src/RpcServer/Settings.cs index d955e48d8..f225ef393 100644 --- a/src/RpcServer/Settings.cs +++ b/src/RpcServer/Settings.cs @@ -17,7 +17,7 @@ internal class Settings public long MaxGasInvoke { get; } public long MaxFee { get; } public string[] DisabledMethods { get; } - + public int MaxConcurrentConnections { get; } public static Settings Default { get; private set; } private Settings(IConfigurationSection section) @@ -32,6 +32,7 @@ private Settings(IConfigurationSection section) this.MaxGasInvoke = (long)BigDecimal.Parse(section.GetValue("MaxGasInvoke", "10"), NativeContract.GAS.Decimals).Value; this.MaxFee = (long)BigDecimal.Parse(section.GetValue("MaxFee", "0.1"), NativeContract.GAS.Decimals).Value; this.DisabledMethods = section.GetSection("DisabledMethods").GetChildren().Select(p => p.Get()).ToArray(); + this.MaxConcurrentConnections = section.GetValue("MaxConcurrentConnections", 40); } public static void Load(IConfigurationSection section)