优化Redis 接收逻辑
This commit is contained in:
@@ -261,6 +261,24 @@ namespace RCUHost.Implement
|
||||
hostRCU.RoomTypeRemark = roomtype_remark;
|
||||
hostRCU.UpdateTime = DateTime.Now;
|
||||
|
||||
RegisterInfo rsg = new RegisterInfo()
|
||||
{
|
||||
hotel_id=hotel_code,
|
||||
room_id=host.RoomNumber,
|
||||
device_id = HostNumberOnly,
|
||||
is_send=0,
|
||||
udp_raw=context.Data,
|
||||
ip_type=ipType,
|
||||
model_num = type_number,
|
||||
server_ip=server_ip,
|
||||
ip=lan_ip+":"+lan_port,
|
||||
subnet_mask=subnet_mask,
|
||||
gateway=gateway,
|
||||
dns=dns,
|
||||
version = software_version,
|
||||
|
||||
};
|
||||
|
||||
HostRepository.SetModelAndLauncher(host, hostRCU.ConfigVersion, software_version, lan_ip, lan_port, model, launcher_version, hostRCU.ExpireTime, hostRCU.SetExpireTime);
|
||||
|
||||
HostRCURepository.SaveOrUpdate(hostRCU);
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace RCUHost.Implement
|
||||
try
|
||||
{
|
||||
var redis = CSRedisCacheHelper.redis1;
|
||||
var data = redis.XReadGroup(group, consumer, 1000, 10, new ValueTuple<string, string>(UDPAllDataKey, ">"));
|
||||
var data = redis.XReadGroup(group, consumer, 500, 10, new ValueTuple<string, string>(UDPAllDataKey, ">"));
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
@@ -147,7 +147,7 @@ namespace RCUHost.Implement
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error("消息队列失败:"+ex.Message);
|
||||
logger.Error("消息队列失败:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace RCUHost.Implement
|
||||
try
|
||||
{
|
||||
udpClient = new UdpClient(3339);
|
||||
udpClient.Client.ReceiveBufferSize = 5 * 1024 * 1024;
|
||||
udpClient.Client.ReceiveBufferSize = 3 * 1024 * 1024;
|
||||
uint IOC_IN = 0x80000000;
|
||||
uint IOC_VENDOR = 0x18000000;
|
||||
uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
|
||||
@@ -459,6 +459,8 @@ namespace RCUHost.Implement
|
||||
{
|
||||
IPEndPoint remoteEP111 = new IPEndPoint(IPAddress.Any, 0);
|
||||
byte[] receiveBuffer111 = state.UdpClient.EndReceive(ar, ref remoteEP111);
|
||||
state.UdpClient.BeginReceive(ReceiveCallback, state);
|
||||
|
||||
if (receiveBuffer111.Length > 0)
|
||||
{
|
||||
|
||||
@@ -719,17 +721,17 @@ namespace RCUHost.Implement
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.udpClient != null)
|
||||
{
|
||||
state.UdpClient.BeginReceive(ReceiveCallback, new UdpState(this.udpClient));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// if (this.udpClient != null)
|
||||
// {
|
||||
// state.UdpClient.BeginReceive(ReceiveCallback, new UdpState(this.udpClient));
|
||||
// }
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1628,7 +1630,7 @@ namespace RCUHost.Implement
|
||||
#region 故意让UDP丢掉的数据包总数
|
||||
//insertcard 保留
|
||||
//if (cmdType != 0x0E||cmdType!=0x01)
|
||||
if (cmdType != 0E || cmdType != 0x03)
|
||||
if (cmdType != 0E && cmdType != 0x03)
|
||||
{
|
||||
if (DataTongJi.DefineLostPackage != 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user