Skip to content

Commit

Permalink
Rename IKcpConversation.OnReceived to InputPakcetAsync
Browse files Browse the repository at this point in the history
(cherry picked from commit ca5da23)
  • Loading branch information
yigolden committed Jun 29, 2021
1 parent 512288b commit 92dedcf
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion samples/KcpChatWasm/PerfectKcpConversationPipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async ValueTask IKcpTransport.SendPacketAsync(ReadOnlyMemory<byte> packet, Cance

public async Task PutPacketAsync(byte[] packet, CancellationToken cancellationToken)
{
await _conversation.OnReceivedAsync(packet, cancellationToken).ConfigureAwait(false);
await _conversation.InputPakcetAsync(packet, cancellationToken).ConfigureAwait(false);
}
}
}
2 changes: 1 addition & 1 deletion samples/KcpEcho/KcpEchoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ValueTask IKcpTransport.SendPacketAsync(ReadOnlyMemory<byte> packet, Cancellatio
=> _sender.SendPacketAsync(_endPoint, packet, cancellationToken);

ValueTask IUdpService.InputPacketAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken)
=> _conversation.OnReceivedAsync(packet, cancellationToken);
=> _conversation.InputPakcetAsync(packet, cancellationToken);

void IUdpService.SetTransportClosed()
=> _conversation.SetTransportClosed();
Expand Down
2 changes: 1 addition & 1 deletion samples/KcpTunnel/KcpTunnelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ValueTask IUdpService.InputPacketAsync(ReadOnlyMemory<byte> packet, Cancellation
ProcessNewConnection(id);
}
}
return _connection.OnReceivedAsync(packet, cancellationToken);
return _connection.InputPakcetAsync(packet, cancellationToken);
}

public void Start()
Expand Down
2 changes: 1 addition & 1 deletion src/KcpSharp/IKcpConversation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface IKcpConversation : IDisposable
/// <param name="packet">The packet content with conversation ID.</param>
/// <param name="cancellationToken">The token to cancel this operation.</param>
/// <returns>A <see cref="ValueTask"/> that completes when the packet is put into the receive queue.</returns>
ValueTask OnReceivedAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken);
ValueTask InputPakcetAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken);

/// <summary>
/// Mark the underlying transport as closed. Abort all active send or receive operations.
Expand Down
2 changes: 1 addition & 1 deletion src/KcpSharp/KcpConversation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ private bool HandleFlushException(Exception ex)
}

/// <inheritdoc />
public ValueTask OnReceivedAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken = default)
public ValueTask InputPakcetAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken = default)
{
if (cancellationToken.IsCancellationRequested)
{
Expand Down
4 changes: 2 additions & 2 deletions src/KcpSharp/KcpMultiplexConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static void ThrowObjectDisposedException()
/// <param name="packet">The content of the packet with conversation ID.</param>
/// <param name="cancellationToken">A token to cancel this operation.</param>
/// <returns>A <see cref="ValueTask"/> that completes when the packet is handled by the corresponding channel or conversation.</returns>
public ValueTask OnReceivedAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken = default)
public ValueTask InputPakcetAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken = default)
{
ReadOnlySpan<byte> span = packet.Span;
if (span.Length < 4)
Expand All @@ -74,7 +74,7 @@ public ValueTask OnReceivedAsync(ReadOnlyMemory<byte> packet, CancellationToken
int id = (int)BinaryPrimitives.ReadUInt32LittleEndian(span);
if (_conversations.TryGetValue(id, out (IKcpConversation Conversation, T? State) value))
{
return value.Conversation.OnReceivedAsync(packet, cancellationToken);
return value.Conversation.InputPakcetAsync(packet, cancellationToken);
}
return default;
}
Expand Down
2 changes: 1 addition & 1 deletion src/KcpSharp/KcpRawChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private bool HandleFlushException(Exception ex)
}

/// <inheritdoc />
public ValueTask OnReceivedAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken = default)
public ValueTask InputPakcetAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken = default)
{
ReadOnlySpan<byte> span = packet.Span;
if (span.Length < 4 || span.Length > _mtu)
Expand Down
2 changes: 1 addition & 1 deletion src/KcpSharp/KcpSocketTransportOfT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private async Task RunReceiveLoopAsync(CancellationTokenSource cts)

if (bytesReceived != 0 && bytesReceived <= _mtu)
{
await connection.OnReceivedAsync(memory.Slice(0, bytesReceived), cancellationToken).ConfigureAwait(false);
await connection.InputPakcetAsync(memory.Slice(0, bytesReceived), cancellationToken).ConfigureAwait(false);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/KcpSharp.Tests/Utils/BadKcpConversationPipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private async Task SendAsync(byte[] packet, CancellationToken cancellationToken)

public async Task PutPacketAsync(byte[] packet, CancellationToken cancellationToken)
{
await _conversation.OnReceivedAsync(packet, cancellationToken).ConfigureAwait(false);
await _conversation.InputPakcetAsync(packet, cancellationToken).ConfigureAwait(false);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/KcpSharp.Tests/Utils/KcpRawDuplexChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async ValueTask IKcpTransport.SendPacketAsync(ReadOnlyMemory<byte> packet, Cance

public async Task PutPacketAsync(byte[] packet, CancellationToken cancellationToken)
{
await ((IKcpConversation)_conversation).OnReceivedAsync(packet, cancellationToken).ConfigureAwait(false);
await ((IKcpConversation)_conversation).InputPakcetAsync(packet, cancellationToken).ConfigureAwait(false);
}
}
}
2 changes: 1 addition & 1 deletion tests/KcpSharp.Tests/Utils/PerfectKcpConversationPipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async ValueTask IKcpTransport.SendPacketAsync(ReadOnlyMemory<byte> packet, Cance

public async Task PutPacketAsync(byte[] packet, CancellationToken cancellationToken)
{
await _conversation.OnReceivedAsync(packet, cancellationToken).ConfigureAwait(false);
await _conversation.InputPakcetAsync(packet, cancellationToken).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ValueTask IKcpTransport.SendPacketAsync(ReadOnlyMemory<byte> packet, Cancellatio
=> _sender.SendPacketAsync(_endPoint, packet, cancellationToken);

ValueTask IUdpService.InputPacketAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken)
=> _conversation.OnReceivedAsync(packet, cancellationToken);
=> _conversation.InputPakcetAsync(packet, cancellationToken);

void IUdpService.SetTransportClosed()
=> _conversation.SetTransportClosed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ValueTask IKcpTransport.SendPacketAsync(ReadOnlyMemory<byte> packet, Cancellatio
=> _sender.SendPacketAsync(_endPoint, packet, cancellationToken);

ValueTask IUdpService.InputPacketAsync(ReadOnlyMemory<byte> packet, CancellationToken cancellationToken)
=> _conversation.OnReceivedAsync(packet, cancellationToken);
=> _conversation.InputPakcetAsync(packet, cancellationToken);

void IUdpService.SetTransportClosed()
=> _conversation.SetTransportClosed();
Expand Down

0 comments on commit 92dedcf

Please sign in to comment.