add workaround for linux connection crashes
This commit is contained in:
@@ -13,4 +13,5 @@ public class ServerStorage
|
|||||||
public bool UseOAuth2 { get; set; } = false;
|
public bool UseOAuth2 { get; set; } = false;
|
||||||
public string? OAuthToken { get; set; } = null;
|
public string? OAuthToken { get; set; } = null;
|
||||||
public HttpTransportType HttpTransportType { get; set; } = HttpTransportType.WebSockets;
|
public HttpTransportType HttpTransportType { get; set; } = HttpTransportType.WebSockets;
|
||||||
|
public bool ForceWebSockets { get; set; } = false;
|
||||||
}
|
}
|
||||||
@@ -1704,6 +1704,21 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
+ "If you run into connection issues with e.g. VPNs, try ServerSentEvents first before trying out LongPolling." + UiSharedService.TooltipSeparator
|
+ "If you run into connection issues with e.g. VPNs, try ServerSentEvents first before trying out LongPolling." + UiSharedService.TooltipSeparator
|
||||||
+ "Note: if the server does not support a specific Transport Type it will fall through to the next automatically: WebSockets > ServerSentEvents > LongPolling");
|
+ "Note: if the server does not support a specific Transport Type it will fall through to the next automatically: WebSockets > ServerSentEvents > LongPolling");
|
||||||
|
|
||||||
|
if (_dalamudUtilService.IsWine)
|
||||||
|
{
|
||||||
|
bool forceWebSockets = selectedServer.ForceWebSockets;
|
||||||
|
if (ImGui.Checkbox("[wine only] Force WebSockets", ref forceWebSockets))
|
||||||
|
{
|
||||||
|
selectedServer.ForceWebSockets = forceWebSockets;
|
||||||
|
_serverConfigurationManager.Save();
|
||||||
|
}
|
||||||
|
_uiShared.DrawHelpText("On wine, Mare will automatically fall back to ServerSentEvents/LongPolling, even if WebSockets is selected. "
|
||||||
|
+ "WebSockets are known to crash XIV entirely on wine 8.5 shipped with Dalamud. "
|
||||||
|
+ "Only enable this if you are not running wine 8.5." + Environment.NewLine
|
||||||
|
+ "Note: If the issue gets resolved at some point this option will be removed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
if (ImGui.Checkbox("Use Discord OAuth2 Authentication", ref useOauth))
|
if (ImGui.Checkbox("Use Discord OAuth2 Authentication", ref useOauth))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using MareSynchronos.API.SignalR;
|
using MareSynchronos.API.SignalR;
|
||||||
|
using MareSynchronos.Services;
|
||||||
using MareSynchronos.Services.Mediator;
|
using MareSynchronos.Services.Mediator;
|
||||||
using MareSynchronos.Services.ServerConfiguration;
|
using MareSynchronos.Services.ServerConfiguration;
|
||||||
using MareSynchronos.WebAPI.SignalR.Utils;
|
using MareSynchronos.WebAPI.SignalR.Utils;
|
||||||
@@ -18,14 +19,17 @@ public class HubFactory : MediatorSubscriberBase
|
|||||||
private readonly TokenProvider _tokenProvider;
|
private readonly TokenProvider _tokenProvider;
|
||||||
private HubConnection? _instance;
|
private HubConnection? _instance;
|
||||||
private bool _isDisposed = false;
|
private bool _isDisposed = false;
|
||||||
|
private readonly bool _isWine = false;
|
||||||
|
|
||||||
public HubFactory(ILogger<HubFactory> logger, MareMediator mediator,
|
public HubFactory(ILogger<HubFactory> logger, MareMediator mediator,
|
||||||
ServerConfigurationManager serverConfigurationManager,
|
ServerConfigurationManager serverConfigurationManager,
|
||||||
TokenProvider tokenProvider, ILoggerProvider pluginLog) : base(logger, mediator)
|
TokenProvider tokenProvider, ILoggerProvider pluginLog,
|
||||||
|
DalamudUtilService dalamudUtilService) : base(logger, mediator)
|
||||||
{
|
{
|
||||||
_serverConfigurationManager = serverConfigurationManager;
|
_serverConfigurationManager = serverConfigurationManager;
|
||||||
_tokenProvider = tokenProvider;
|
_tokenProvider = tokenProvider;
|
||||||
_loggingProvider = pluginLog;
|
_loggingProvider = pluginLog;
|
||||||
|
_isWine = dalamudUtilService.IsWine;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DisposeHubAsync()
|
public async Task DisposeHubAsync()
|
||||||
@@ -66,8 +70,14 @@ public class HubFactory : MediatorSubscriberBase
|
|||||||
_ => HttpTransportType.WebSockets | HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling
|
_ => HttpTransportType.WebSockets | HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling
|
||||||
};
|
};
|
||||||
|
|
||||||
var baseTransport = _serverConfigurationManager.GetTransport();
|
if (_isWine && !_serverConfigurationManager.CurrentServer.ForceWebSockets
|
||||||
Logger.LogDebug("Building new HubConnection using transport {transport}", baseTransport);
|
&& transportType.HasFlag(HttpTransportType.WebSockets))
|
||||||
|
{
|
||||||
|
Logger.LogDebug("Wine detected, falling back to ServerSentEvents / LongPolling");
|
||||||
|
transportType = HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.LogDebug("Building new HubConnection using transport {transport}", transportType);
|
||||||
|
|
||||||
_instance = new HubConnectionBuilder()
|
_instance = new HubConnectionBuilder()
|
||||||
.WithUrl(_serverConfigurationManager.CurrentApiUrl + IMareHub.Path, options =>
|
.WithUrl(_serverConfigurationManager.CurrentApiUrl + IMareHub.Path, options =>
|
||||||
|
|||||||
Reference in New Issue
Block a user