Commit 367d6dcd authored by Honfika's avatar Honfika

Now=>UtcNow

parent 987dafc9
......@@ -53,7 +53,7 @@ namespace Titanium.Web.Proxy.EventArguments
{
BufferPool = server.BufferPool;
ExceptionFunc = server.ExceptionFunc;
TimeLine["Session Created"] = DateTime.Now;
TimeLine["Session Created"] = DateTime.UtcNow;
CancellationTokenSource = cancellationTokenSource;
......
......@@ -92,7 +92,7 @@ namespace Titanium.Web.Proxy.Http
/// <param name="serverConnection">Instance of <see cref="TcpServerConnection" /></param>
internal void SetConnection(TcpServerConnection serverConnection)
{
serverConnection.LastAccess = DateTime.Now;
serverConnection.LastAccess = DateTime.UtcNow;
connection = serverConnection;
}
......
......@@ -105,7 +105,7 @@ namespace Titanium.Web.Proxy.Network.Certificate
// KeyLength
const int keyLength = 2048;
var now = DateTime.Now;
var now = DateTime.UtcNow;
var graceTime = now.AddDays(graceDays);
var certificate = makeCertificate(sSubjectCN, fullSubject, keyLength, hashAlgo, graceTime,
now.AddDays(validDays), signingCertificate);
......
......@@ -459,7 +459,7 @@ namespace Titanium.Web.Proxy.Network
// check in cache first
if (cachedCertificates.TryGetValue(certificateName, out var cached))
{
cached.LastAccess = DateTime.Now;
cached.LastAccess = DateTime.UtcNow;
return cached.Certificate;
}
......@@ -498,7 +498,7 @@ namespace Titanium.Web.Proxy.Network
var cancellationToken = clearCertificatesTokenSource.Token;
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();
......
......@@ -241,7 +241,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
if (cache.TryGetValue(cacheKey, out var existingConnections))
{
// +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)
{
if (existingConnections.TryDequeue(out var recentConnection))
......@@ -350,7 +350,7 @@ retry:
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));
......@@ -458,7 +458,7 @@ retry:
if (newUpstreamProxy != null)
{
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);
}
}
......@@ -468,7 +468,7 @@ retry:
if (sessionArgs != null)
{
sessionArgs.TimeLine["Connection Established"] = DateTime.Now;
sessionArgs.TimeLine["Connection Established"] = DateTime.UtcNow;
}
await proxyServer.InvokeServerConnectionCreateEvent(tcpServerSocket);
......@@ -532,7 +532,7 @@ retry:
if (sessionArgs != null)
{
sessionArgs.TimeLine["HTTPS Established"] = DateTime.Now;
sessionArgs.TimeLine["HTTPS Established"] = DateTime.UtcNow;
}
}
}
......@@ -570,7 +570,7 @@ retry:
return;
}
connection.LastAccess = DateTime.Now;
connection.LastAccess = DateTime.UtcNow;
try
{
......@@ -634,7 +634,7 @@ retry:
{
try
{
var cutOff = DateTime.Now.AddSeconds(-Server.ConnectionTimeOutSeconds);
var cutOff = DateTime.UtcNow.AddSeconds(-Server.ConnectionTimeOutSeconds);
foreach (var item in cache)
{
var queue = item.Value;
......
......@@ -20,7 +20,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
Version version, IExternalProxy? upStreamProxy, IPEndPoint? upStreamEndPoint, string cacheKey)
{
TcpSocket = tcpSocket;
LastAccess = DateTime.Now;
LastAccess = DateTime.UtcNow;
this.proxyServer = proxyServer;
this.proxyServer.UpdateServerConnectionCount(true);
Stream = stream;
......
......@@ -43,7 +43,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
Credentials = new Common.SecurityHandle(0);
Context = new Common.SecurityHandle(0);
LastSeen = DateTime.Now;
LastSeen = DateTime.UtcNow;
AuthState = WinAuthState.UNAUTHORIZED;
}
......@@ -56,7 +56,7 @@ namespace Titanium.Web.Proxy.Network.WinAuth.Security
internal void UpdatePresence()
{
LastSeen = DateTime.Now;
LastSeen = DateTime.UtcNow;
}
}
}
......@@ -279,7 +279,7 @@ namespace Titanium.Web.Proxy
// set the connection and send request headers
args.HttpClient.SetConnection(connection);
args.TimeLine["Connection Ready"] = DateTime.Now;
args.TimeLine["Connection Ready"] = DateTime.UtcNow;
if (args.HttpClient.Request.UpgradeToWebSocket)
{
......@@ -335,7 +335,7 @@ namespace Titanium.Web.Proxy
}
}
args.TimeLine["Request Sent"] = DateTime.Now;
args.TimeLine["Request Sent"] = DateTime.UtcNow;
// parse and send response
await handleHttpSessionResponse(args);
......@@ -374,7 +374,7 @@ namespace Titanium.Web.Proxy
/// <returns></returns>
private async Task onBeforeRequest(SessionEventArgs args)
{
args.TimeLine["Request Received"] = DateTime.Now;
args.TimeLine["Request Received"] = DateTime.UtcNow;
if (BeforeRequest != null)
{
......
......@@ -32,7 +32,7 @@ namespace Titanium.Web.Proxy
await args.HttpClient.ReceiveResponse(cancellationToken);
}
args.TimeLine["Response Received"] = DateTime.Now;
args.TimeLine["Response Received"] = DateTime.UtcNow;
var response = args.HttpClient.Response;
args.ReRequest = false;
......@@ -122,7 +122,7 @@ namespace Titanium.Web.Proxy
}
}
args.TimeLine["Response Sent"] = DateTime.Now;
args.TimeLine["Response Sent"] = DateTime.UtcNow;
}
/// <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