Skip to content

Commit

Permalink
Improve responsiveness (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMacocian authored Nov 26, 2023
1 parent 174794b commit 7e4849a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GuildWarsPartySearch/GuildWarsPartySearch.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ItemGroup>
<PackageReference Include="Azure.Data.Tables" Version="12.8.2" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="MTSC" Version="5.5.1" />
<PackageReference Include="MTSC" Version="5.5.2" />
<PackageReference Include="Slim" Version="1.9.2" />
<PackageReference Include="Slim.Integration" Version="1.0.4" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ void IHandler.Tick(MTSC.ServerSide.Server server)
{
if (!initialized)
{
initialized = true;
inactivityTimeout = server.ServiceManager.GetRequiredService<IOptions<ServerOptions>>().Value.InactivityTimeout ?? TimeSpan.FromSeconds(15);
this.initialized = true;
this.inactivityTimeout = server.ServiceManager.GetRequiredService<IOptions<ServerOptions>>().Value.InactivityTimeout ?? TimeSpan.FromSeconds(15);
}

foreach (ClientData client in server.Clients)
{
if (DateTime.Now - client.LastActivityTime > inactivityTimeout)
if (DateTime.Now - client.LastActivityTime > this.inactivityTimeout &&
!IsConnected(client.Socket))
{
server.Log("Disconnected: " + client.Socket.RemoteEndPoint?.ToString());
client.ToBeRemoved = true;
Expand Down

0 comments on commit 7e4849a

Please sign in to comment.