设备退网,删除后 再传送退网消息个哦gawayserver 会导致逻辑错误。。

This commit is contained in:
cdyong 2016-01-19 09:16:33 +00:00
parent 7626f74d1c
commit acad019d26
1 changed files with 10 additions and 3 deletions

View File

@ -103,7 +103,8 @@ bool TinyServer::OnReceive(TinyMessage& msg)
dv = Current;
break;
case 2:
OnDisjoin(msg);
if(OnDisjoin(msg))
if(Received) return Received(this, msg, Param);
break;
case 3:
// 设置当前设备
@ -346,13 +347,19 @@ bool TinyServer::OnDisjoin(const TinyMessage& msg)
ushort crc1 = ms.ReadUInt16();
ushort crc2 = Crc::Hash16(dv->GetHardID());
if(crc1 == crc2)
DeleteDevice(dv->Address);
{
//DeleteDevice(dv->Address);
return true;
}
else
{
debug_printf("0x%02X 非法退网,请求的硬件校验 0x%04X 不等于本地硬件校验 0x%04X", dv->Address, crc1, crc2);
return false;
}
}
}
return true;
return false;
}
bool TinyServer::Disjoin(TinyMessage& msg, ushort crc) const