mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 08:03:12 +08:00
Fix incorrect connection building due to bad merges
This commit is contained in:
parent
805da56746
commit
fb8e31a303
@ -71,20 +71,6 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
if (!await connectionLock.WaitAsync(10000))
|
if (!await connectionLock.WaitAsync(10000))
|
||||||
throw new TimeoutException("Could not obtain a lock to connect. A previous attempt is likely stuck.");
|
throw new TimeoutException("Could not obtain a lock to connect. A previous attempt is likely stuck.");
|
||||||
|
|
||||||
var builder = new HubConnectionBuilder()
|
|
||||||
.WithUrl(endpoint, options => { options.Headers.Add("Authorization", $"Bearer {api.AccessToken}"); });
|
|
||||||
|
|
||||||
if (RuntimeInfo.SupportsJIT)
|
|
||||||
builder.AddMessagePackProtocol();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// eventually we will precompile resolvers for messagepack, but this isn't working currently
|
|
||||||
// see https://github.com/neuecc/MessagePack-CSharp/issues/780#issuecomment-768794308.
|
|
||||||
builder.AddNewtonsoftJsonProtocol(options => { options.PayloadSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; });
|
|
||||||
}
|
|
||||||
|
|
||||||
connection = builder.Build();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (api.State.Value == APIState.Online)
|
while (api.State.Value == APIState.Online)
|
||||||
@ -235,10 +221,19 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
|
|
||||||
private HubConnection createConnection(CancellationToken cancellationToken)
|
private HubConnection createConnection(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var newConnection = new HubConnectionBuilder()
|
var builder = new HubConnectionBuilder()
|
||||||
.WithUrl(endpoint, options => { options.Headers.Add("Authorization", $"Bearer {api.AccessToken}"); })
|
.WithUrl(endpoint, options => { options.Headers.Add("Authorization", $"Bearer {api.AccessToken}"); });
|
||||||
.AddNewtonsoftJsonProtocol(options => { options.PayloadSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; })
|
|
||||||
.Build();
|
if (RuntimeInfo.SupportsJIT)
|
||||||
|
builder.AddMessagePackProtocol();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// eventually we will precompile resolvers for messagepack, but this isn't working currently
|
||||||
|
// see https://github.com/neuecc/MessagePack-CSharp/issues/780#issuecomment-768794308.
|
||||||
|
builder.AddNewtonsoftJsonProtocol(options => { options.PayloadSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; });
|
||||||
|
}
|
||||||
|
|
||||||
|
var newConnection = builder.Build();
|
||||||
|
|
||||||
// this is kind of SILLY
|
// this is kind of SILLY
|
||||||
// https://github.com/dotnet/aspnetcore/issues/15198
|
// https://github.com/dotnet/aspnetcore/issues/15198
|
||||||
|
Loading…
Reference in New Issue
Block a user