private void SetTimespanTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE type, TimeSpan value) { long timeoutValue; // // All timeouts are defined as USHORT in native layer (except MinSendRate, which is ULONG). Make sure that // timeout value is within range. // timeoutValue = Convert.ToInt64(value.TotalSeconds); if (timeoutValue < 0 || timeoutValue > ushort.MaxValue) { throw new ArgumentOutOfRangeException(nameof(value)); } // // Use local state to get values for other timeouts. Call into the native layer and if that // call succeeds, update local state. // int[] currentTimeouts = _timeouts; currentTimeouts[(int)type] = (int)timeoutValue; _listener.SetServerTimeout(currentTimeouts, _minSendBytesPerSecond); _timeouts[(int)type] = (int)timeoutValue; }
private TimeSpan GetTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE type) { // // Since we maintain local state, GET is local. // return(new TimeSpan(0, 0, (int)_timeouts[(int)type])); }