Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HttpListenerTimeoutManager.cs
Go to the documentation of this file.
2
3namespace System.Net;
4
6{
7 private readonly HttpListener _listener;
8
9 private readonly int[] _timeouts;
10
12
14 {
15 get
16 {
17 return GetTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.EntityBody);
18 }
19 [SupportedOSPlatform("windows")]
20 set
21 {
22 SetTimespanTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.EntityBody, value);
23 }
24 }
25
27 {
28 get
29 {
30 return GetTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.DrainEntityBody);
31 }
32 set
33 {
34 SetTimespanTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.DrainEntityBody, value);
35 }
36 }
37
39 {
40 get
41 {
42 return GetTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.RequestQueue);
43 }
44 [SupportedOSPlatform("windows")]
45 set
46 {
47 SetTimespanTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.RequestQueue, value);
48 }
49 }
50
52 {
53 get
54 {
55 return GetTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.IdleConnection);
56 }
57 set
58 {
59 SetTimespanTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.IdleConnection, value);
60 }
61 }
62
64 {
65 get
66 {
67 return GetTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.HeaderWait);
68 }
69 [SupportedOSPlatform("windows")]
70 set
71 {
72 SetTimespanTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE.HeaderWait, value);
73 }
74 }
75
77 {
78 get
79 {
81 }
82 [SupportedOSPlatform("windows")]
83 set
84 {
85 if (value < 0 || value > uint.MaxValue)
86 {
87 throw new ArgumentOutOfRangeException("value");
88 }
91 }
92 }
93
95 {
96 _listener = context;
97 _timeouts = new int[5];
98 }
99
100 private TimeSpan GetTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE type)
101 {
102 return new TimeSpan(0, 0, _timeouts[(int)type]);
103 }
104
105 private void SetTimespanTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE type, TimeSpan value)
106 {
107 long num = Convert.ToInt64(value.TotalSeconds);
108 if (num < 0 || num > 65535)
109 {
110 throw new ArgumentOutOfRangeException("value");
111 }
112 int[] timeouts = _timeouts;
113 timeouts[(int)type] = (int)num;
115 _timeouts[(int)type] = (int)num;
116 }
117}
static long ToInt64(object? value)
Definition Convert.cs:1623
void SetTimespanTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE type, TimeSpan value)
TimeSpan GetTimeout(global::Interop.HttpApi.HTTP_TIMEOUT_TYPE type)
unsafe void SetServerTimeout(int[] timeouts, uint minSendBytesPerSecond)