Merge branch 'wvp-28181-2.0' into database-structure-optimization
commit
9fa4bf6f77
6
pom.xml
6
pom.xml
|
@ -207,6 +207,12 @@
|
||||||
<version>2.1.3</version>
|
<version>2.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>20.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- json解析库fastjson2 -->
|
<!-- json解析库fastjson2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.fastjson2</groupId>
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
|
import com.google.common.primitives.Bytes;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
import gov.nist.javax.sip.message.SIPResponse;
|
import gov.nist.javax.sip.message.SIPResponse;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
@ -196,15 +197,14 @@ public abstract class SIPRequestProcessorParent {
|
||||||
result.add(rawContent[i]);
|
result.add(rawContent[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Byte[] bytes = new Byte[0];
|
byte[] bytesResult = Bytes.toArray(result);
|
||||||
byte[] bytesResult = ArrayUtils.toPrimitive(result.toArray(bytes));
|
|
||||||
|
|
||||||
Document xml;
|
Document xml;
|
||||||
try {
|
try {
|
||||||
xml = reader.read(new ByteArrayInputStream(bytesResult));
|
xml = reader.read(new ByteArrayInputStream(bytesResult));
|
||||||
}catch (DocumentException e) {
|
}catch (DocumentException e) {
|
||||||
logger.warn("[xml解析异常]: 愿文如下: \r\n{}", new String(bytesResult));
|
logger.warn("[xml解析异常]: 原文如下: \r\n{}", new String(bytesResult));
|
||||||
logger.warn("[xml解析异常]: 愿文如下: 尝试兼容性处理");
|
logger.warn("[xml解析异常]: 原文如下: 尝试兼容性处理");
|
||||||
String[] xmlLineArray = new String(bytesResult).split("\\r?\\n");
|
String[] xmlLineArray = new String(bytesResult).split("\\r?\\n");
|
||||||
|
|
||||||
// 兼容海康的address字段带有<破换xml结构导致无法解析xml的问题
|
// 兼容海康的address字段带有<破换xml结构导致无法解析xml的问题
|
||||||
|
|
|
@ -233,19 +233,17 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
try {
|
try {
|
||||||
commanderForPlatform.keepalive(parentPlatform, eventResult -> {
|
commanderForPlatform.keepalive(parentPlatform, eventResult -> {
|
||||||
// 心跳失败
|
// 心跳失败
|
||||||
if (eventResult.type == SipSubscribe.EventResultType.timeout) {
|
if (eventResult.type != SipSubscribe.EventResultType.timeout) {
|
||||||
// 心跳超时
|
|
||||||
ParentPlatformCatch platformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
|
|
||||||
// 此时是第三次心跳超时, 平台离线
|
|
||||||
if (platformCatch.getKeepAliveReply() == 2) {
|
|
||||||
// 设置平台离线,并重新注册
|
|
||||||
logger.info("[国标级联] 三次心跳超时, 平台{}({})离线", parentPlatform.getName(), parentPlatform.getServerGBId());
|
|
||||||
offline(parentPlatform, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
|
||||||
logger.warn("[国标级联]发送心跳收到错误,code: {}, msg: {}", eventResult.statusCode, eventResult.msg);
|
logger.warn("[国标级联]发送心跳收到错误,code: {}, msg: {}", eventResult.statusCode, eventResult.msg);
|
||||||
}
|
}
|
||||||
|
// 心跳失败
|
||||||
|
ParentPlatformCatch platformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
|
||||||
|
// 此时是第三次心跳超时, 平台离线
|
||||||
|
if (platformCatch.getKeepAliveReply() == 2) {
|
||||||
|
// 设置平台离线,并重新注册
|
||||||
|
logger.info("[国标级联] 三次心跳超时, 平台{}({})离线", parentPlatform.getName(), parentPlatform.getServerGBId());
|
||||||
|
offline(parentPlatform, false);
|
||||||
|
}
|
||||||
|
|
||||||
}, eventResult -> {
|
}, eventResult -> {
|
||||||
// 心跳成功
|
// 心跳成功
|
||||||
|
|
Loading…
Reference in New Issue