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

check session for null #497

Merged
merged 1 commit into from
Sep 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
throw new Exception($"Could not resolve the hostname {hostname}");
}

session.TimeLine["Dns Resolved"] = DateTime.Now;
if (session != null)
{
session.TimeLine["Dns Resolved"] = DateTime.Now;
}

var ipAddresses = ipHostEntry.AddressList;

Expand All @@ -313,7 +316,10 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
}
}

session.TimeLine["Connection Established"] = DateTime.Now;
if (session != null)
{
session.TimeLine["Connection Established"] = DateTime.Now;
}

await proxyServer.InvokeConnectionCreateEvent(tcpClient, false);

Expand Down Expand Up @@ -370,7 +376,12 @@ private async Task<TcpServerConnection> createServerConnection(string remoteHost
#if NETCOREAPP2_1
negotiatedApplicationProtocol = sslStream.NegotiatedApplicationProtocol;
#endif
session.TimeLine["HTTPS Established"] = DateTime.Now;

if (session != null)
{
session.TimeLine["HTTPS Established"] = DateTime.Now;
}

}
}
catch (Exception)
Expand Down