Skip to content

Commit 9910cf9

Browse files
committed
more comments
1 parent 7dc1316 commit 9910cf9

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

src/SuperSocket.Command/CommandExecutingContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace SuperSocket.Command
66
{
7+
/// <summary>
8+
/// Represents the context for executing a command.
9+
/// </summary>
710
public struct CommandExecutingContext
811
{
912
/// <summary>

src/SuperSocket.Connection/PipeConnection.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ private static Pipe GetOutputPipe(ConnectionOptions connectionOptions)
6262
return connectionOptions.Output ?? new Pipe();
6363
}
6464

65+
/// <inheritdoc/>
6566
protected override async Task GetConnectionTask(Task readTask, CancellationToken cancellationToken)
6667
{
6768
await Task.WhenAll(FillPipeAsync(Input.Writer, cancellationToken), ProcessSends()).ConfigureAwait(false);

src/SuperSocket.Connection/PipeConnectionBase.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ protected void UpdateLastActiveTime()
8787
LastActiveTime = DateTimeOffset.Now;
8888
}
8989

90+
/// <summary>
91+
/// Gets a task which represents the connection.
92+
/// </summary>
93+
/// <param name="readTask">The read task.</param>
94+
/// <param name="cancellationToken">The cancellation token.</param>
9095
protected virtual async Task GetConnectionTask(Task readTask, CancellationToken cancellationToken)
9196
{
9297
await readTask.ConfigureAwait(false);
@@ -182,6 +187,9 @@ public override async ValueTask CloseAsync(CloseReason closeReason)
182187
await connectionTask.ConfigureAwait(false);
183188
}
184189

190+
/// <summary>
191+
/// Cancels all the operations on the connection.
192+
/// </summary>
185193
protected async Task CancelAsync()
186194
{
187195
if (_cts.IsCancellationRequested)
@@ -191,6 +199,10 @@ protected async Task CancelAsync()
191199
await CompleteWriterAsync(OutputWriter, _isDetaching).ConfigureAwait(false);
192200
}
193201

202+
/// <summary>
203+
/// Checks if the specified exception is ignorable.
204+
/// </summary>
205+
/// <param name="e">The exception.</param>
194206
protected virtual bool IsIgnorableException(Exception e)
195207
{
196208
if (e is ObjectDisposedException || e is NullReferenceException)
@@ -297,16 +309,33 @@ public override async ValueTask SendAsync(Action<PipeWriter> write, Cancellation
297309
}
298310
}
299311

312+
/// <summary>
313+
/// Writes a package to the output writer using the specified encoder.
314+
/// </summary>
315+
/// <typeparam name="TPackage">The package type.</typeparam>
316+
/// <param name="writer">The buffer writer.</param>
317+
/// <param name="packageEncoder">The package encoder.</param>
318+
/// <param name="package">The package.</param>
300319
protected void WritePackageWithEncoder<TPackage>(IBufferWriter<byte> writer, IPackageEncoder<TPackage> packageEncoder, TPackage package)
301320
{
302321
CheckConnectionSendAllowed();
303322
packageEncoder.Encode(writer, package);
304323
}
305324

325+
/// <summary>
326+
/// Invoked when data is read from the input pipe.
327+
/// </summary>
328+
/// <param name="result">The read result.</param>
306329
protected virtual void OnInputPipeRead(ReadResult result)
307330
{
308331
}
309332

333+
/// <summary>
334+
/// Reads data from the input pipe asynchronously and processes it using the specified pipeline filter.
335+
/// </summary>
336+
/// <typeparam name="TPackageInfo">The package type.</typeparam>
337+
/// <param name="reader">The pipe reader.</param>
338+
/// <param name="cancellationToken">The cancellation token.</param>
310339
protected async IAsyncEnumerable<TPackageInfo> ReadPipeAsync<TPackageInfo>(PipeReader reader, [EnumeratorCancellation] CancellationToken cancellationToken)
311340
{
312341
var pipelineFilter = _pipelineFilter as IPipelineFilter<TPackageInfo>;
@@ -494,11 +523,21 @@ protected void OnError(string message, Exception e = null)
494523
Logger?.LogError(message);
495524
}
496525

526+
/// <summary>
527+
/// Completes the reader asynchronously.
528+
/// </summary>
529+
/// <param name="reader">The pipe reader.</param>
530+
/// <param name="isDetaching">Indicates if this operation is a part of detaching action.</param>
497531
protected virtual async ValueTask CompleteReaderAsync(PipeReader reader, bool isDetaching)
498532
{
499533
await reader.CompleteAsync().ConfigureAwait(false);
500534
}
501535

536+
/// <summary>
537+
/// Completes the writer asynchronously.
538+
/// </summary>
539+
/// <param name="writer">The pipe writer.</param>
540+
/// <param name="isDetaching">Indicates if this operation is a part of detaching action.</param>
502541
protected virtual async ValueTask CompleteWriterAsync(PipeWriter writer, bool isDetaching)
503542
{
504543
await writer.CompleteAsync().ConfigureAwait(false);

0 commit comments

Comments
 (0)