Commit 367d6dcd authored by Honfika's avatar Honfika

Now=>UtcNow

parent 987dafc9
...@@ -53,7 +53,7 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -53,7 +53,7 @@ namespace Titanium.Web.Proxy.EventArguments
{ {
BufferPool = server.BufferPool; BufferPool = server.BufferPool;
ExceptionFunc = server.ExceptionFunc; ExceptionFunc = server.ExceptionFunc;
TimeLine["Session Created"] = DateTime.Now; TimeLine["Session Created"] = DateTime.UtcNow;
CancellationTokenSource = cancellationTokenSource; CancellationTokenSource = cancellationTokenSource;
......
...@@ -92,7 +92,7 @@ namespace Titanium.Web.Proxy.Http ...@@ -92,7 +92,7 @@ namespace Titanium.Web.Proxy.Http
/// <param name="serverConnection">Instance of <see cref="TcpServerConnection" /></param> /// <param name="serverConnection">Instance of <see cref="TcpServerConnection" /></param>
internal void SetConnection(TcpServerConnection serverConnection) internal void SetConnection(TcpServerConnection serverConnection)
{ {
serverConnection.LastAccess = DateTime.Now; serverConnection.LastAccess = DateTime.UtcNow;
connection = serverConnection; connection = serverConnection;
} }
......
...@@ -105,7 +105,7 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -105,7 +105,7 @@ namespace Titanium.Web.Proxy.Network.Certificate
// KeyLength // KeyLength
const int keyLength = 2048; const int keyLength = 2048;
var now = DateTime.Now; var now = DateTime.UtcNow;
var graceTime = now.AddDays(graceDays); var graceTime = now.AddDays(graceDays);
var certificate = makeCertificate(sSubjectCN, fullSubject, keyLength, hashAlgo, graceTime, var certificate = makeCertificate(sSubjectCN, fullSubject, keyLength, hashAlgo, graceTime,
now.AddDays(validDays), signingCertificate); now.AddDays(validDays), signingCertificate);
......
...@@ -459,7 +459,7 @@ namespace Titanium.Web.Proxy.Network ...@@ -459,7 +459,7 @@ namespace Titanium.Web.Proxy.Network
// check in cache first // check in cache first
if (cachedCertificates.TryGetValue(certificateName, out var cached)) if (cachedCertificates.TryGetValue(certificateName, out var cached))
{ {
cached.LastAccess = DateTime.Now; cached.LastAccess = DateTime.UtcNow;
return cached.Certificate; return cached.Certificate;
} }
...@@ -498,7 +498,7 @@ namespace Titanium.Web.Proxy.Network ...@@ -498,7 +498,7 @@ namespace Titanium.Web.Proxy.Network
var cancellationToken = clearCertificatesTokenSource.Token; var cancellationToken = clearCertificatesTokenSource.Token;
while (!cancellationToken.IsCancellationRequested) while (!cancellationToken.IsCancellationRequested)
{ {
var cutOff = DateTime.Now.AddMinutes(-CertificateCacheTimeOutMinutes); var cutOff = DateTime.UtcNow.AddMinutes(-CertificateCacheTimeOutMinutes);
var outdated = cachedCertificates.Where(x => x.Value.LastAccess < cutOff).ToList(); var outdated = cachedCertificates.Where(x => x.Value.LastAccess < cutOff).ToList();
......
...@@ -241,7 +241,7 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -241,7 +241,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
if (cache.TryGetValue(cacheKey, out var existingConnections)) if (cache.TryGetValue(cacheKey, out var existingConnections))
{ {
// +3 seconds for potential delay after getting connection // +3 seconds for potential delay after getting connection
var cutOff = DateTime.Now.AddSeconds(-proxyServer.ConnectionTimeOutSeconds + 3); var cutOff = DateTime.UtcNow.AddSeconds(-proxyServer.ConnectionTimeOutSeconds + 3);
while (existingConnections.Count > 0) while (existingConnections.Count > 0)
{ {
if (existingConnections.TryDequeue(out var recentConnection)) if (existingConnections.TryDequeue(out var recentConnection))
...@@ -350,7 +350,7 @@ retry: ...@@ -350,7 +350,7 @@ retry:
if (sessionArgs != null) if (sessionArgs != null)
{ {
sessionArgs.TimeLine["Dns Resolved"] = DateTime.Now; sessionArgs.TimeLine["Dns Resolved"] = DateTime.UtcNow;
} }
Array.Sort(ipAddresses, (x, y) => x.AddressFamily.CompareTo(y.AddressFamily)); Array.Sort(ipAddresses, (x, y) => x.AddressFamily.CompareTo(y.AddressFamily));
...@@ -458,7 +458,7 @@ retry: ...@@ -458,7 +458,7 @@ retry:
if (newUpstreamProxy != null) if (newUpstreamProxy != null)
{ {
sessionArgs.CustomUpStreamProxyUsed = newUpstreamProxy; sessionArgs.CustomUpStreamProxyUsed = newUpstreamProxy;
sessionArgs.TimeLine["Retrying Upstream Proxy Connection"] = DateTime.Now; sessionArgs.TimeLine["Retrying Upstream Proxy Connection"] = DateTime.UtcNow;
return await createServerConnection(remoteHostName, remotePort, httpVersion, isHttps, sslProtocol, applicationProtocols, isConnect, proxyServer, sessionArgs, upStreamEndPoint, externalProxy, cacheKey, cancellationToken); return await createServerConnection(remoteHostName, remotePort, httpVersion, isHttps, sslProtocol, applicationProtocols, isConnect, proxyServer, sessionArgs, upStreamEndPoint, externalProxy, cacheKey, cancellationToken);
} }
} }
...@@ -468,7 +468,7 @@ retry: ...@@ -468,7 +468,7 @@ retry:
if (sessionArgs != null) if (sessionArgs != null)
{ {
sessionArgs.TimeLine["Connection Established"] = DateTime.Now; sessionArgs.TimeLine["Connection Established"] = DateTime.UtcNow;
} }
await proxyServer.InvokeServerConnectionCreateEvent(tcpServerSocket); await proxyServer.InvokeServerConnectionCreateEvent(tcpServerSocket);
...@@ -532,7 +532,7 @@ retry: ...@@ -532,7 +532,7 @@ retry:
if (sessionArgs != null) if (sessionArgs != null)
{ {
sessionArgs.TimeLine["HTTPS Established"] = DateTime.Now; sessionArgs.TimeLine["HTTPS Established"] = DateTime.UtcNow;
} }
} }
} }
...@@ -570,7 +570,7 @@ retry: ...@@ -570,7 +570,7 @@ retry:
return; return;
} }
connection.LastAccess = DateTime.Now; connection.LastAccess = DateTime.UtcNow;
try try
{ {
...@@ -634,7 +634,7 @@ retry: ...@@ -634,7 +634,7 @@ retry:
{ {
try try
{ {
var cutOff = DateTime.Now.AddSeconds(-Server.ConnectionTimeOutSeconds); var cutOff = DateTime.UtcNow.AddSeconds(-Server.ConnectionTimeOutSeconds);
foreach (var item in cache) foreach (var item in cache)
{ {
var queue = item.Value; var queue = item.Value;
......
...@@ -20,7 +20,7 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -20,7 +20,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
Version version, IExternalProxy? upStreamProxy, IPEndPoint? upStreamEndPoint, string cacheKey) Version version, IExternalProxy? upStreamProxy, IPEndPoint? upStreamEndPoint, string cacheKey)
{ {
TcpSocket = tcpSocket; TcpSocket = tcpSocket;
LastAccess = DateTime.Now; LastAccess = DateTime.UtcNow;
this.proxyServer = proxyServer; this.proxyServer = proxyServer;
this.proxyServer.UpdateServerConnectionCount(true); this.proxyServer.UpdateServerConnectionCount(true);
Stream = stream; Stream = stream;
......
...@@ -43,7 +43,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security ...@@ -43,7 +43,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
Credentials = new Common.SecurityHandle(0); Credentials = new Common.SecurityHandle(0);
Context = new Common.SecurityHandle(0); Context = new Common.SecurityHandle(0);
LastSeen = DateTime.Now; LastSeen = DateTime.UtcNow;
AuthState = WinAuthState.UNAUTHORIZED; AuthState = WinAuthState.UNAUTHORIZED;
} }
...@@ -56,7 +56,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security ...@@ -56,7 +56,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
internal void UpdatePresence() internal void UpdatePresence()
{ {
LastSeen = DateTime.Now; LastSeen = DateTime.UtcNow;
} }
} }
} }
...@@ -279,7 +279,7 @@ namespace Titanium.Web.Proxy ...@@ -279,7 +279,7 @@ namespace Titanium.Web.Proxy
// set the connection and send request headers // set the connection and send request headers
args.HttpClient.SetConnection(connection); args.HttpClient.SetConnection(connection);
args.TimeLine["Connection Ready"] = DateTime.Now; args.TimeLine["Connection Ready"] = DateTime.UtcNow;
if (args.HttpClient.Request.UpgradeToWebSocket) if (args.HttpClient.Request.UpgradeToWebSocket)
{ {
...@@ -335,7 +335,7 @@ namespace Titanium.Web.Proxy ...@@ -335,7 +335,7 @@ namespace Titanium.Web.Proxy
} }
} }
args.TimeLine["Request Sent"] = DateTime.Now; args.TimeLine["Request Sent"] = DateTime.UtcNow;
// parse and send response // parse and send response
await handleHttpSessionResponse(args); await handleHttpSessionResponse(args);
...@@ -374,7 +374,7 @@ namespace Titanium.Web.Proxy ...@@ -374,7 +374,7 @@ namespace Titanium.Web.Proxy
/// <returns></returns> /// <returns></returns>
private async Task onBeforeRequest(SessionEventArgs args) private async Task onBeforeRequest(SessionEventArgs args)
{ {
args.TimeLine["Request Received"] = DateTime.Now; args.TimeLine["Request Received"] = DateTime.UtcNow;
if (BeforeRequest != null) if (BeforeRequest != null)
{ {
......
...@@ -32,7 +32,7 @@ namespace Titanium.Web.Proxy ...@@ -32,7 +32,7 @@ namespace Titanium.Web.Proxy
await args.HttpClient.ReceiveResponse(cancellationToken); await args.HttpClient.ReceiveResponse(cancellationToken);
} }
args.TimeLine["Response Received"] = DateTime.Now; args.TimeLine["Response Received"] = DateTime.UtcNow;
var response = args.HttpClient.Response; var response = args.HttpClient.Response;
args.ReRequest = false; args.ReRequest = false;
...@@ -122,7 +122,7 @@ namespace Titanium.Web.Proxy ...@@ -122,7 +122,7 @@ namespace Titanium.Web.Proxy
} }
} }
args.TimeLine["Response Sent"] = DateTime.Now; args.TimeLine["Response Sent"] = DateTime.UtcNow;
} }
/// <summary> /// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment