Skip to content

Commit

Permalink
[fix] Tcp连续收到多个空包才断开连接
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Jan 2, 2024
1 parent 3a5bbb7 commit fcb7717
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion NewLife.Core/Net/TcpSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private void OnEndRead(IAsyncResult ar)
using var span = Tracer?.NewSpan($"net:{Name}:EmptyData", remote?.ToString());

// 连续多次空数据,则断开
if (DisconnectWhenEmptyData || _empty++ > 3)
if (DisconnectWhenEmptyData && ++_empty >= 3)
{
Close("EmptyData");
Dispose();
Expand Down

0 comments on commit fcb7717

Please sign in to comment.