diff --git a/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs b/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs index e64554ddd..81736133c 100644 --- a/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs +++ b/Agent.Installer.Win/ViewModels/MainWindowViewModel.cs @@ -389,7 +389,7 @@ private async Task ExtractDeviceInitInfo() if (Guid.TryParse(guid, out _)) { OrganizationID = guid; - return; + break; } diff --git a/Server/Hubs/CasterHub.cs b/Server/Hubs/CasterHub.cs index b846e7d13..e720e3a65 100644 --- a/Server/Hubs/CasterHub.cs +++ b/Server/Hubs/CasterHub.cs @@ -64,16 +64,22 @@ public IceServerModel[] GetIceServers() public Task GetSessionID() { var random = new Random(); - var sessionID = ""; - for (var i = 0; i < 3; i++) + var sessionId = ""; + + while (string.IsNullOrWhiteSpace(sessionId) || + SessionInfoList.ContainsKey(sessionId)) { - sessionID += random.Next(0, 999).ToString().PadLeft(3, '0'); + for (var i = 0; i < 3; i++) + { + sessionId += random.Next(0, 999).ToString().PadLeft(3, '0'); + } } - Context.Items["SessionID"] = sessionID; + + Context.Items["SessionID"] = sessionId; - SessionInfoList[Context.ConnectionId].AttendedSessionID = sessionID; + SessionInfoList[Context.ConnectionId].AttendedSessionID = sessionId; - return Clients.Caller.SendAsync("SessionID", sessionID); + return Clients.Caller.SendAsync("SessionID", sessionId); } public Task NotifyRequesterUnattendedReady(string browserHubConnectionID) diff --git a/Server/Startup.cs b/Server/Startup.cs index 9108300f6..769d21a92 100644 --- a/Server/Startup.cs +++ b/Server/Startup.cs @@ -158,7 +158,7 @@ public void ConfigureServices(IServiceCollection services) services.AddSignalR(options => { options.EnableDetailedErrors = IsDev; - options.MaximumReceiveMessageSize = 500_000; + options.MaximumReceiveMessageSize = 100_000; }) .AddJsonProtocol(options => { @@ -242,21 +242,9 @@ public void Configure(IApplicationBuilder app, app.UseEndpoints(endpoints => { - endpoints.MapHub("/AgentHub", options => - { - options.ApplicationMaxBufferSize = 500_000; - options.TransportMaxBufferSize = 500_000; - }); - endpoints.MapHub("/CasterHub", options => - { - options.ApplicationMaxBufferSize = 100_000; - options.TransportMaxBufferSize = 100_000; - }); - endpoints.MapHub("/ViewerHub", options => - { - options.ApplicationMaxBufferSize = 100_000; - options.TransportMaxBufferSize = 100_000; - }); + endpoints.MapHub("/AgentHub"); + endpoints.MapHub("/CasterHub"); + endpoints.MapHub("/ViewerHub"); endpoints.MapControllers(); endpoints.MapBlazorHub();