public DefaultRuntimeEnvironment() { OperatingSystem = PlatformApis.GetOSName(); OperatingSystemVersion = PlatformApis.GetOSVersion(); OperatingSystemPlatform = PlatformApis.GetOSPlatform(); RuntimeType = GetRuntimeType(); RuntimeVersion = typeof(object).GetTypeInfo().Assembly.GetName().Version.ToString(); RuntimeArchitecture = GetArch(); }
// Called on Libuv thread public void Tick(long timestamp) { if (timestamp > PlatformApis.VolatileRead(ref _timeoutTimestamp)) { ConnectionControl.CancelTimeout(); if (_timeoutAction == TimeoutAction.SendTimeoutResponse) { _frame.SetBadRequestState(RequestRejectionReason.RequestTimeout); } StopAsync(); } Interlocked.Exchange(ref _lastTimestamp, timestamp); }
// Called by the Timer (background) thread private void TimerLoop(object state) { var now = _systemClock.UtcNow; SetDateValues(now); if (_hadRequestsSinceLastTimerTick) { // We served requests since the last tick, reset the flag and return as we're still active _hadRequestsSinceLastTimerTick = false; Interlocked.Exchange(ref _lastRequestSeenTicks, now.Ticks); return; } // No requests since the last timer tick, we need to check if we're beyond the idle threshold if ((now.Ticks - PlatformApis.VolatileRead(ref _lastRequestSeenTicks)) >= _timeWithoutRequestsUntilIdle.Ticks) { // No requests since idle threshold so stop the timer if it's still running StopTimer(); } }