Skip to content

Commit 512288b

Browse files
committed
Change ConversationId property to be nullable.
(cherry picked from commit 38aee33)
1 parent b2dfe68 commit 512288b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

samples/KcpTunnel/TcpForwardConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public async Task RunAsync()
7575
}
7676
finally
7777
{
78-
_connection.UnregisterConversation(_conversation.ConversationId)?.Dispose();
78+
_connection.UnregisterConversation(_conversation.ConversationId.GetValueOrDefault())?.Dispose();
7979
_conversation.Dispose();
8080
Console.WriteLine("Conversation closed: " + _conversation.ConversationId);
8181
}

samples/KcpTunnel/TcpSourceConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ public async Task RunAsync()
7171
}
7272
finally
7373
{
74-
_connection.UnregisterConversation(_conversation.ConversationId)?.Dispose();
74+
_connection.UnregisterConversation(_conversation.ConversationId.GetValueOrDefault())?.Dispose();
7575
_conversation.Dispose();
76-
_idPool.Return((ushort)_conversation.ConversationId);
76+
_idPool.Return((ushort)_conversation.ConversationId.GetValueOrDefault());
7777
Console.WriteLine("Conversation closed: " + _conversation.ConversationId);
7878
}
7979
}

src/KcpSharp/KcpConversation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public void SetExceptionHandler(Func<Exception, KcpConversation, object?, bool>
175175
/// <summary>
176176
/// Get the ID of the current conversation.
177177
/// </summary>
178-
public int ConversationId => (int)_id;
178+
public int? ConversationId => (int)_id;
179179

180180
/// <summary>
181181
/// Get whether the transport is marked as closed.

src/KcpSharp/KcpRawChannel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void SetExceptionHandler(Func<Exception, KcpRawChannel, object?, bool> ha
8282
/// <summary>
8383
/// Get the ID of the current conversation.
8484
/// </summary>
85-
public int ConversationId => (int)_id;
85+
public int? ConversationId => (int)_id;
8686

8787
/// <summary>
8888
/// Get whether the transport is marked as closed.

0 commit comments

Comments
 (0)