This repository was archived by the owner on Dec 18, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
src/Microsoft.AspNet.Server.Kestrel
test/Microsoft.AspNet.Server.KestrelTests Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public KestrelServerInformation(IConfiguration configuration)
15
15
{
16
16
Addresses = GetAddresses ( configuration ) ;
17
17
ThreadCount = GetThreadCount ( configuration ) ;
18
- NoDelay = true ;
18
+ NoDelay = GetNoDelay ( configuration ) ;
19
19
}
20
20
21
21
public ICollection < string > Addresses { get ; }
@@ -68,5 +68,23 @@ private static int GetThreadCount(IConfiguration configuration)
68
68
69
69
return threadCount ;
70
70
}
71
+
72
+ private static bool GetNoDelay ( IConfiguration configuration )
73
+ {
74
+ var noDelayString = configuration [ "kestrel.noDelay" ] ;
75
+
76
+ if ( string . IsNullOrEmpty ( noDelayString ) )
77
+ {
78
+ return true ;
79
+ }
80
+
81
+ bool noDelay ;
82
+ if ( bool . TryParse ( noDelayString , out noDelay ) )
83
+ {
84
+ return noDelay ;
85
+ }
86
+
87
+ return true ;
88
+ }
71
89
}
72
90
}
Original file line number Diff line number Diff line change @@ -62,6 +62,23 @@ public void SetAddressesUsingConfiguration()
62
62
Assert . Equal ( expected , information . Addresses ) ;
63
63
}
64
64
65
+ [ Fact ]
66
+ public void SetNoDelayUsingConfiguration ( )
67
+ {
68
+ var values = new Dictionary < string , string >
69
+ {
70
+ { "kestrel.noDelay" , "false" }
71
+ } ;
72
+
73
+ var configuration = new ConfigurationBuilder ( )
74
+ . AddInMemoryCollection ( values )
75
+ . Build ( ) ;
76
+
77
+ var information = new KestrelServerInformation ( configuration ) ;
78
+
79
+ Assert . False ( information . NoDelay ) ;
80
+ }
81
+
65
82
private static int Clamp ( int value , int min , int max )
66
83
{
67
84
return value < min ? min : value > max ? max : value ;
You can’t perform that action at this time.
0 commit comments