From 0c27d93ab9ed81332f8da106a1a1a19a56f47feb Mon Sep 17 00:00:00 2001 From: cdyong <273797002@qq.com> Date: Wed, 4 Nov 2015 08:37:24 +0000 Subject: [PATCH] =?UTF-8?q?=E5=81=8F=E7=A7=BB=E9=87=8F=E5=A4=A7=E4=BA=8E?= =?UTF-8?q?=E4=B8=BB=E6=95=B0=E6=8D=AE=E5=8C=BA=E8=A7=84=E5=AE=9A=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=EF=BC=8C=E8=BD=AC=E5=90=91=E5=86=99=E5=85=A5=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=95=B0=E6=8D=AE=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinyNet/TinyServer.cpp | 7 ++++++- TinyNet/TinyServer.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/TinyNet/TinyServer.cpp b/TinyNet/TinyServer.cpp index f6d1c726..3156aa2a 100644 --- a/TinyNet/TinyServer.cpp +++ b/TinyNet/TinyServer.cpp @@ -21,6 +21,7 @@ TinyServer::TinyServer(TinyController* control) Control->Param = this; Control->Mode = 2; // 服务端接收所有消息 + DataStoreLent =64; Received = NULL; Param = NULL; @@ -437,7 +438,11 @@ bool TinyServer::OnWrite(TinyMessage& msg, Device& dv) // 起始地址为7位压缩编码整数 Stream ms = msg.ToStream(); uint offset = ms.ReadEncodeInt(); - + + if(offset>DataStoreLent) + { + return true; + } // 计算还有多少数据可写 uint len = ms.Remain(); int remain = dv.Store.Capacity() - offset; diff --git a/TinyNet/TinyServer.h b/TinyNet/TinyServer.h index 778fb483..24873158 100644 --- a/TinyNet/TinyServer.h +++ b/TinyNet/TinyServer.h @@ -14,6 +14,7 @@ class TinyServer { private: + byte DataStoreLent; public: TinyController* Control;