Commit 370f1e72 authored by 潘栩锋's avatar 潘栩锋 🚴

Merge remote-tracking branch 'remotes/gitlab/dev6.0' into feature-feng-rayAndLaser-20210306

# Conflicts:
#	Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_Base.cs
parents 08549d34 04761ec3
......@@ -113,7 +113,13 @@ namespace FObjBase
return -1;
}
else if (plen < 2) {
//异常,包最短也有2个byte
logger.Error($"TCPConn GetRecvInfoPacket 包.Size = {plen},太小,不正常, 断开重新连接");
sock.Close();
return -1;
}
if (len < plen)
{
return 0;
......@@ -121,6 +127,14 @@ namespace FObjBase
if (HasCRC) //TODO
{
if (plen < 4) {
//
logger.Error("TCPConn GetRecvInfoPacket 包.Size < 4, 无法 CRC 校验。 断开重新连接");
sock.Close();
return -1;
}
UInt16 crc = Misc.CRC.CRC16(in_buffer, 0, plen - 2);
int packet_crc_idx = plen - 2;
UInt16 packet_crc = BitConverter.ToUInt16(in_buffer.GetRange(packet_crc_idx, 2).ToArray(), 0);
......
......@@ -40,8 +40,16 @@ namespace FLY.Thick.Base.Server
}
public void Start(int delay)
{
Delay = delay;
Start();
if (delay <= 0)
{
ReScan();
return;
}
else
{
Delay = delay;
Start();
}
}
public override void Start()
{
......
......@@ -56,7 +56,13 @@ namespace FLY.Thick.Base.Server
if (isReadyToAutoScan)
{
//需要自动扫描
if (stopwatch.Elapsed > TimeSpan.FromMinutes(3))
if (stopwatch.Elapsed < TimeSpan.FromSeconds(30)) {
isReadyToAutoScan = false;
stopwatch.Stop();
//30秒内又连上了,直接重启
mGMAutoScan.Start(0);
}
else if (stopwatch.Elapsed < TimeSpan.FromMinutes(3))
{
isReadyToAutoScan = false;
stopwatch.Stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment