allow connection when characteridentification is not null but it's the same user
This commit is contained in:
@@ -45,7 +45,7 @@ namespace MareSynchronosServer.Hubs
|
||||
{
|
||||
_logger.LogInformation("Connection from " + userId);
|
||||
var user = (await _dbContext.Users.SingleAsync(u => u.UID == userId));
|
||||
if (!string.IsNullOrEmpty(user.CharacterIdentification))
|
||||
if (!string.IsNullOrEmpty(user.CharacterIdentification) && characterIdentification != user.CharacterIdentification)
|
||||
{
|
||||
return new ConnectionDto()
|
||||
{
|
||||
@@ -86,6 +86,8 @@ namespace MareSynchronosServer.Hubs
|
||||
|
||||
public override async Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
MareMetrics.Connections.Dec();
|
||||
|
||||
var user = await _dbContext.Users.AsNoTracking().SingleOrDefaultAsync(u => u.UID == AuthenticatedUserId);
|
||||
if (user != null && !string.IsNullOrEmpty(user.CharacterIdentification))
|
||||
{
|
||||
@@ -112,8 +114,6 @@ namespace MareSynchronosServer.Hubs
|
||||
await _dbContext.Users.CountAsync(u => !string.IsNullOrEmpty(u.CharacterIdentification)));
|
||||
}
|
||||
|
||||
MareMetrics.Connections.Dec();
|
||||
|
||||
await base.OnDisconnectedAsync(exception);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,6 @@ namespace MareSynchronosServer
|
||||
|
||||
System.Threading.ThreadPool.GetMaxThreads(out int worker, out int io);
|
||||
Console.WriteLine($"Before: Worker threads {worker}, IO threads {io}");
|
||||
System.Threading.ThreadPool.SetMaxThreads(worker, 10000);
|
||||
System.Threading.ThreadPool.GetMaxThreads(out int workerNew, out int ioNew);
|
||||
Console.WriteLine($"After: Worker threads {workerNew}, IO threads {ioNew}");
|
||||
|
||||
using (var scope = host.Services.CreateScope())
|
||||
{
|
||||
@@ -41,6 +38,10 @@ namespace MareSynchronosServer
|
||||
context.RemoveRange(looseFiles);
|
||||
context.SaveChanges();
|
||||
|
||||
System.Threading.ThreadPool.SetMaxThreads(worker, context.Users.Count() * 5);
|
||||
System.Threading.ThreadPool.GetMaxThreads(out int workerNew, out int ioNew);
|
||||
Console.WriteLine($"After: Worker threads {workerNew}, IO threads {ioNew}");
|
||||
|
||||
MareMetrics.InitializeMetrics(context, services.GetRequiredService<IConfiguration>());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user