1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 19:22:56 +08:00

Rename Socket* -> PersistentEndpoint*

This commit is contained in:
Dan Balasescu 2022-11-02 11:43:22 +09:00
parent 8a37649097
commit 46d1713e28
4 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.SignalR.Client;
namespace osu.Game.Online namespace osu.Game.Online
{ {
public class HubClient : SocketClient public class HubClient : PersistentEndpointClient
{ {
public readonly HubConnection Connection; public readonly HubConnection Connection;

View File

@ -14,7 +14,7 @@ using osu.Game.Online.API;
namespace osu.Game.Online namespace osu.Game.Online
{ {
public class HubClientConnector : SocketClientConnector, IHubClientConnector public class HubClientConnector : PersistentEndpointClientConnector, IHubClientConnector
{ {
public const string SERVER_SHUTDOWN_MESSAGE = "Server is shutting down."; public const string SERVER_SHUTDOWN_MESSAGE = "Server is shutting down.";
@ -51,7 +51,7 @@ namespace osu.Game.Online
this.preferMessagePack = preferMessagePack; this.preferMessagePack = preferMessagePack;
} }
protected override Task<SocketClient> BuildConnectionAsync(CancellationToken cancellationToken) protected override Task<PersistentEndpointClient> BuildConnectionAsync(CancellationToken cancellationToken)
{ {
var builder = new HubConnectionBuilder() var builder = new HubConnectionBuilder()
.WithUrl(endpoint, options => .WithUrl(endpoint, options =>
@ -91,7 +91,7 @@ namespace osu.Game.Online
ConfigureConnection?.Invoke(newConnection); ConfigureConnection?.Invoke(newConnection);
return Task.FromResult((SocketClient)new HubClient(newConnection)); return Task.FromResult((PersistentEndpointClient)new HubClient(newConnection));
} }
protected override string ClientName { get; } protected override string ClientName { get; }

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace osu.Game.Online namespace osu.Game.Online
{ {
public abstract class SocketClient : IAsyncDisposable public abstract class PersistentEndpointClient : IAsyncDisposable
{ {
public event Func<Exception?, Task>? Closed; public event Func<Exception?, Task>? Closed;

View File

@ -12,7 +12,7 @@ using osu.Game.Online.API;
namespace osu.Game.Online namespace osu.Game.Online
{ {
public abstract class SocketClientConnector : Component public abstract class PersistentEndpointClientConnector : Component
{ {
/// <summary> /// <summary>
/// Whether this is connected to the hub, use <see cref="CurrentConnection"/> to access the connection, if this is <c>true</c>. /// Whether this is connected to the hub, use <see cref="CurrentConnection"/> to access the connection, if this is <c>true</c>.
@ -22,7 +22,7 @@ namespace osu.Game.Online
/// <summary> /// <summary>
/// The current connection opened by this connector. /// The current connection opened by this connector.
/// </summary> /// </summary>
public SocketClient? CurrentConnection { get; private set; } public PersistentEndpointClient? CurrentConnection { get; private set; }
private readonly Bindable<bool> isConnected = new Bindable<bool>(); private readonly Bindable<bool> isConnected = new Bindable<bool>();
private readonly SemaphoreSlim connectionLock = new SemaphoreSlim(1); private readonly SemaphoreSlim connectionLock = new SemaphoreSlim(1);
@ -34,7 +34,7 @@ namespace osu.Game.Online
/// Constructs a new <see cref="HubClientConnector"/>. /// Constructs a new <see cref="HubClientConnector"/>.
/// </summary> /// </summary>
/// <param name="api"> An API provider used to react to connection state changes.</param> /// <param name="api"> An API provider used to react to connection state changes.</param>
protected SocketClientConnector(IAPIProvider api) protected PersistentEndpointClientConnector(IAPIProvider api)
{ {
apiState.BindTo(api.State); apiState.BindTo(api.State);
apiState.BindValueChanged(_ => Task.Run(connectIfPossible), true); apiState.BindValueChanged(_ => Task.Run(connectIfPossible), true);
@ -124,7 +124,7 @@ namespace osu.Game.Online
await Task.Delay(5000, cancellationToken).ConfigureAwait(false); await Task.Delay(5000, cancellationToken).ConfigureAwait(false);
} }
protected abstract Task<SocketClient> BuildConnectionAsync(CancellationToken cancellationToken); protected abstract Task<PersistentEndpointClient> BuildConnectionAsync(CancellationToken cancellationToken);
private async Task onConnectionClosed(Exception? ex, CancellationToken cancellationToken) private async Task onConnectionClosed(Exception? ex, CancellationToken cancellationToken)
{ {