Browse Source

修复一个socket错误,socket读取到0字节数据表示连接已经断开。该错误会导致死循环

tanghai 8 năm trước cách đây
mục cha
commit
ffb0172473
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      Unity/Assets/Plugins/Base/Network/TNet/TChannel.cs

+ 6 - 0
Unity/Assets/Plugins/Base/Network/TNet/TChannel.cs

@@ -197,6 +197,12 @@ namespace Base
 				this.OnError(this, error);
 				return;
 			}
+
+			if (n == 0)
+			{
+				this.OnError(this, error);
+				return;
+			}
 			
 			this.recvBuffer.LastIndex += n;
 			if (this.recvBuffer.LastIndex == TBuffer.ChunkSize)