private void SetTimespanTimeout(UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE type, TimeSpan value) { Int64 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("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(UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE type) { // // Since we maintain local state, GET is local. // return(new TimeSpan(0, 0, (int)timeouts[(int)type])); }
private void SetTimespanTimeout(UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE type, TimeSpan value) { long num = Convert.ToInt64(value.TotalSeconds); if ((num < 0L) || (num > 0xffffL)) { throw new ArgumentOutOfRangeException("value"); } int[] timeouts = this.timeouts; timeouts[(int)type] = (int)num; this.listener.SetServerTimeout(timeouts, this.minSendRate); this.timeouts[(int)type] = (int)num; }
private TimeSpan GetTimeout(UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE type) { return(new TimeSpan(0, 0, this.timeouts[(int)type])); }