|
|
@@ -283,11 +283,11 @@ namespace ETModel
|
|
|
}
|
|
|
|
|
|
// 超时断开连接
|
|
|
- if (timeNow - this.lastRecvTime > 40 * 1000)
|
|
|
- {
|
|
|
- this.OnError(ErrorCode.ERR_KcpChannelTimeout);
|
|
|
- return;
|
|
|
- }
|
|
|
+ //if (timeNow - this.lastRecvTime > 40 * 1000)
|
|
|
+ //{
|
|
|
+ // this.OnError(ErrorCode.ERR_KcpChannelTimeout);
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
@@ -425,6 +425,13 @@ namespace ETModel
|
|
|
|
|
|
public override void Send(MemoryStream stream)
|
|
|
{
|
|
|
+ // 检查等待发送的消息,如果超出两倍窗口大小,应该断开连接
|
|
|
+ if (Kcp.KcpWaitsnd(this.kcp) > 256 * 2)
|
|
|
+ {
|
|
|
+ this.OnError(ErrorCode.ERR_KcpWaitSendSizeTooLarge);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
ushort size = (ushort)(stream.Length - stream.Position);
|
|
|
byte[] bytes;
|
|
|
if (this.isConnected)
|