Upgrade to .net 8
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using Shogi.Contracts.Socket;
|
||||
using Shogi.Contracts.Types;
|
||||
using System.Buffers;
|
||||
@@ -16,7 +16,7 @@ public class ShogiSocket : IDisposable
|
||||
|
||||
private ClientWebSocket socket;
|
||||
private readonly JsonSerializerOptions serializerOptions;
|
||||
private readonly UriBuilder uriBuilder;
|
||||
private readonly string baseUrl;
|
||||
private readonly CancellationTokenSource cancelToken;
|
||||
private readonly IMemoryOwner<byte> memoryOwner;
|
||||
private bool disposedValue;
|
||||
@@ -25,7 +25,7 @@ public class ShogiSocket : IDisposable
|
||||
{
|
||||
this.socket = new ClientWebSocket();
|
||||
this.serializerOptions = serializerOptions;
|
||||
this.uriBuilder = new UriBuilder(configuration["SocketUrl"] ?? throw new InvalidOperationException("SocketUrl configuration is missing."));
|
||||
this.baseUrl = configuration["SocketUrl"] ?? throw new InvalidOperationException("SocketUrl configuration is missing.");
|
||||
this.cancelToken = new CancellationTokenSource();
|
||||
this.memoryOwner = MemoryPool<byte>.Shared.Rent(1024 * 2);
|
||||
}
|
||||
@@ -46,8 +46,8 @@ public class ShogiSocket : IDisposable
|
||||
Console.WriteLine("Opening socket and existing socket state is " + this.socket.State.ToString());
|
||||
}
|
||||
|
||||
uriBuilder.Query = new QueryBuilder { { "token", token } }.ToQueryString().Value;
|
||||
await socket.ConnectAsync(this.uriBuilder.Uri, cancelToken.Token);
|
||||
var uri = new Uri(QueryHelpers.AddQueryString(this.baseUrl, "token", token), UriKind.Absolute);
|
||||
await socket.ConnectAsync(uri, cancelToken.Token);
|
||||
// Fire and forget! I'm way too lazy to write my own javascript interop to a web worker. Nooo thanks.
|
||||
_ = Listen()
|
||||
.ContinueWith(async antecedent =>
|
||||
|
||||
Reference in New Issue
Block a user