再加陷阱

This commit is contained in:
nnhy 2015-08-05 03:45:03 +00:00
parent 2bb9e1f713
commit 2d250a4df2
1 changed files with 2 additions and 0 deletions

View File

@ -68,8 +68,10 @@ uint Controller::Dispatch(ITransport* port, byte* buf, uint len, void* param)
Stream ms(buf, len); Stream ms(buf, len);
while(ms.Remain() >= control->MinSize) while(ms.Remain() >= control->MinSize)
{ {
assert_param2(_my == control, "控制器指针已被改变");
// 如果不是有效数据包,则直接退出,避免产生死循环。当然,也可以逐字节移动测试,不过那样性能太差 // 如果不是有效数据包,则直接退出,避免产生死循环。当然,也可以逐字节移动测试,不过那样性能太差
if(!control->Dispatch(ms, NULL)) break; if(!control->Dispatch(ms, NULL)) break;
assert_param2(_my == control, "控制器指针已被改变");
} }
return 0; return 0;