mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 20:30:50 +08:00 
			
		
		
		
	initial commit for new feature #1077
allow to limit the number of concurrent tcp connection to a downstream service
This commit is contained in:
		@@ -52,7 +52,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true, int.MaxValue))
 | 
			
		||||
                .WithDelegatingHandlers(new List<string>
 | 
			
		||||
                {
 | 
			
		||||
                    "FakeDelegatingHandler",
 | 
			
		||||
@@ -88,7 +88,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true, int.MaxValue))
 | 
			
		||||
                .WithDelegatingHandlers(new List<string>
 | 
			
		||||
                {
 | 
			
		||||
                    "FakeDelegatingHandlerTwo",
 | 
			
		||||
@@ -125,7 +125,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true, int.MaxValue))
 | 
			
		||||
                .WithDelegatingHandlers(new List<string>
 | 
			
		||||
                {
 | 
			
		||||
                    "FakeDelegatingHandlerTwo",
 | 
			
		||||
@@ -161,7 +161,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true, int.MaxValue))
 | 
			
		||||
                .WithDelegatingHandlers(new List<string>
 | 
			
		||||
                {
 | 
			
		||||
                    "FakeDelegatingHandler",
 | 
			
		||||
@@ -195,7 +195,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
@@ -221,7 +221,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true, int.MaxValue))
 | 
			
		||||
                .WithDelegatingHandlers(new List<string>
 | 
			
		||||
                {
 | 
			
		||||
                    "FakeDelegatingHandler",
 | 
			
		||||
@@ -249,7 +249,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true)).WithLoadBalancerKey("").Build();
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true, int.MaxValue)).WithLoadBalancerKey("").Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => GivenTheFollowingRequest(reRoute))
 | 
			
		||||
                .And(x => GivenTheQosFactoryReturns(new FakeQoSHandler()))
 | 
			
		||||
@@ -269,7 +269,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true)).WithLoadBalancerKey("").Build();
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true, int.MaxValue)).WithLoadBalancerKey("").Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => GivenTheFollowingRequest(reRoute))
 | 
			
		||||
                .And(x => GivenTheServiceProviderReturnsNothing())
 | 
			
		||||
@@ -289,7 +289,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true)).WithLoadBalancerKey("").Build();
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true, int.MaxValue)).WithLoadBalancerKey("").Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => GivenTheFollowingRequest(reRoute))
 | 
			
		||||
                .And(x => GivenTheQosFactoryReturns(new FakeQoSHandler()))
 | 
			
		||||
@@ -309,7 +309,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true)).WithLoadBalancerKey("").Build();
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true, int.MaxValue)).WithLoadBalancerKey("").Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => GivenTheFollowingRequest(reRoute))
 | 
			
		||||
                .And(x => GivenTheQosFactoryReturns(new FakeQoSHandler()))
 | 
			
		||||
@@ -331,7 +331,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
@@ -361,7 +361,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(true, true, true, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -73,7 +73,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -99,7 +99,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -126,7 +126,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRouteA = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithContainsQueryString(true).WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -134,7 +134,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRouteB = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithContainsQueryString(true).WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -161,7 +161,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -184,7 +184,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -216,7 +216,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, true, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, true, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -252,7 +252,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue("").Build())
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(upstreamTemplate)
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -86,7 +86,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(upstreamTemplate)
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().Build())
 | 
			
		||||
@@ -114,7 +114,7 @@ namespace Ocelot.UnitTests.Requester
 | 
			
		||||
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithQosOptions(qosOptions)
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true))
 | 
			
		||||
                .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, true, int.MaxValue))
 | 
			
		||||
                .WithLoadBalancerKey("")
 | 
			
		||||
                .WithUpstreamPathTemplate(upstreamTemplate)
 | 
			
		||||
                .WithQosOptions(new QoSOptionsBuilder().WithTimeoutValue(1).Build())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user