Skip to content

Commit c474489

Browse files
committed
[修改] Server 模块重命名 SessionID→SessionId,统一命名规范
1 parent f27d665 commit c474489

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/GameFrameX.SuperSocket.Server/AppSession.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public AppSession()
3636
/// </summary>
3737
/// <param name="server">The server information.</param>
3838
/// <param name="connection">The connection associated with the session.</param>
39-
void IAppSession.Initialize(IServerInfo server, IConnection connection)
39+
public void Initialize(IServerInfo server, IConnection connection)
4040
{
4141
if (connection is IConnectionWithSessionIdentifier connectionWithSessionIdentifier)
4242
{
@@ -85,6 +85,9 @@ public bool IsConnected
8585
}
8686
}
8787

88+
/// <summary>
89+
/// Gets the server information associated with this session.
90+
/// </summary>
8891
public IServerInfo Server { get; private set; }
8992

9093
IConnection IAppSession.Connection
@@ -107,7 +110,9 @@ public EndPoint RemoteEndPoint
107110
var connection = _connection;
108111

109112
if (connection == null)
113+
{
110114
return null;
115+
}
111116

112117
return connection.ProxyInfo?.SourceEndPoint ?? connection.RemoteEndPoint;
113118
}
@@ -167,7 +172,9 @@ public object this[object name]
167172
var items = _items;
168173

169174
if (items == null)
175+
{
170176
items = _items = new Dictionary<object, object>();
177+
}
171178

172179
items[name] = value;
173180
}
@@ -198,7 +205,9 @@ internal async ValueTask FireSessionClosedAsync(CloseEventArgs e)
198205
var closeEventHandler = Closed;
199206

200207
if (closeEventHandler == null)
208+
{
201209
return;
210+
}
202211

203212
await closeEventHandler.Invoke(this, e);
204213
}
@@ -261,7 +270,7 @@ public virtual ValueTask SendAsync(ReadOnlyMemory<byte> data, CancellationToken
261270
/// <param name="data">The sequence of binary data to send.</param>
262271
/// <param name="cancellationToken">The token for canceling the operation.</param>
263272
/// <returns>A task representing the asynchronous send operation.</returns>
264-
public ValueTask SendAsync(ReadOnlySequence<byte> data, CancellationToken cancellationToken = default)
273+
public virtual ValueTask SendAsync(ReadOnlySequence<byte> data, CancellationToken cancellationToken = default)
265274
{
266275
return _connection.SendAsync(data, cancellationToken);
267276
}
@@ -274,7 +283,7 @@ public ValueTask SendAsync(ReadOnlySequence<byte> data, CancellationToken cancel
274283
/// <param name="package">The package to send.</param>
275284
/// <param name="cancellationToken">The cancellation token.</param>
276285
/// <returns>A task representing the async send operation.</returns>
277-
public ValueTask SendAsync<TPackage>(IPackageEncoder<TPackage> packageEncoder, TPackage package, CancellationToken cancellationToken)
286+
public virtual ValueTask SendAsync<TPackage>(IPackageEncoder<TPackage> packageEncoder, TPackage package, CancellationToken cancellationToken)
278287
{
279288
return _connection.SendAsync(packageEncoder, package, cancellationToken);
280289
}
@@ -404,7 +413,10 @@ IDisposable ILogger.BeginScope<TState>(TState state)
404413
/// <summary>
405414
/// Gets the logger associated with the session.
406415
/// </summary>
407-
public ILogger Logger => this as ILogger;
416+
public ILogger Logger
417+
{
418+
get { return this as ILogger; }
419+
}
408420

409421
#endregion
410422
}

0 commit comments

Comments
 (0)