Browse Source

优化收到心跳的信息更新判断

pull/484/head
648540858 2 years ago
parent
commit
973e75f808
  1. 14
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java

14
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java

@ -49,13 +49,6 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
return;
}
try {
if (device.getOnline() == 1) {
// 回复200 OK
responseAck(evt, Response.OK);
}else {
// 对于已经离线的设备判断他的注册是否已经过期
if (!deviceService.expire(device)){
device.setKeepaliveTime(DateUtil.getNow());
// 判断RPort是否改变,改变则说明路由nat信息变化,修改设备信息
// 获取到通信地址等信息
ViaHeader viaHeader = (ViaHeader) evt.getRequest().getHeader(ViaHeader.NAME);
@ -71,6 +64,13 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
device.setHostAddress(received.concat(":").concat(String.valueOf(rPort)));
}
device.setKeepaliveTime(DateUtil.getNow());
if (device.getOnline() == 1) {
// 回复200 OK
responseAck(evt, Response.OK);
deviceService.updateDevice(device);
}else {
// 对于已经离线的设备判断他的注册是否已经过期
if (!deviceService.expire(device)){
deviceService.online(device);
// 回复200 OK
responseAck(evt, Response.OK);

Loading…
Cancel
Save