Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit f316617

Browse files
Merge pull request #497 from justcoding121/master
check session for null
2 parents 08167b4 + bf98361 commit f316617

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
293293
throw new Exception($"Could not resolve the hostname {hostname}");
294294
}
295295

296-
session.TimeLine["Dns Resolved"] = DateTime.Now;
296+
if (session != null)
297+
{
298+
session.TimeLine["Dns Resolved"] = DateTime.Now;
299+
}
297300

298301
var ipAddresses = ipHostEntry.AddressList;
299302

@@ -313,7 +316,10 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
313316
}
314317
}
315318

316-
session.TimeLine["Connection Established"] = DateTime.Now;
319+
if (session != null)
320+
{
321+
session.TimeLine["Connection Established"] = DateTime.Now;
322+
}
317323

318324
await proxyServer.InvokeConnectionCreateEvent(tcpClient, false);
319325

@@ -370,7 +376,12 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
370376
#if NETCOREAPP2_1
371377
negotiatedApplicationProtocol = sslStream.NegotiatedApplicationProtocol;
372378
#endif
373-
session.TimeLine["HTTPS Established"] = DateTime.Now;
379+
380+
if (session != null)
381+
{
382+
session.TimeLine["HTTPS Established"] = DateTime.Now;
383+
}
384+
374385
}
375386
}
376387
catch (Exception)

0 commit comments

Comments
 (0)