fix:增加echo调试代码
This commit is contained in:
parent
eadd667511
commit
ffda80fb01
File diff suppressed because one or more lines are too long
@ -260,8 +260,6 @@ class ScpMessage {
|
|||||||
} else {
|
} else {
|
||||||
throw FormatException("Invalid PayloadLength length");
|
throw FormatException("Invalid PayloadLength length");
|
||||||
}
|
}
|
||||||
print(
|
|
||||||
"======================messageId: ${message.MessageId}, spTotal: ${message.SpTotal}, spIndex: ${message.SpIndex}, payloadType: ${message.PayloadType}, payloadLength: ${message.PayloadLength}");
|
|
||||||
|
|
||||||
// 处理其他类型的Payload
|
// 处理其他类型的Payload
|
||||||
if (message.PayloadLength != null &&
|
if (message.PayloadLength != null &&
|
||||||
@ -532,20 +530,25 @@ class ScpMessage {
|
|||||||
_packetBuffer[messageId] = List.filled(spTotal, []);
|
_packetBuffer[messageId] = List.filled(spTotal, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查分包索引是否在合法范围内
|
||||||
|
if (spIndex < 1 || spIndex > spTotal) {
|
||||||
|
print('Invalid spIndex: $spIndex for messageId: $messageId');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 存储当前分包
|
// 存储当前分包
|
||||||
_packetBuffer[messageId]![spIndex - 1] = byte;
|
_packetBuffer[messageId]![spIndex - 1] = byte;
|
||||||
|
|
||||||
// 检查是否接收到所有分包
|
// 检查是否接收到所有分包
|
||||||
if (_packetBuffer[messageId]!.every((packet) => packet.isNotEmpty)) {
|
if (_packetBuffer[messageId]!.every((packet) => packet.isNotEmpty)) {
|
||||||
// 重组所有分包
|
// 重组所有分包
|
||||||
List<int> completePayload =
|
List<int> completePayload = _packetBuffer[messageId]!.expand((packet) => packet).toList();
|
||||||
_packetBuffer[messageId]!.expand((packet) => packet).toList();
|
|
||||||
|
|
||||||
// 清除已重组的分包数据
|
// 清除已重组的分包数据
|
||||||
_packetBuffer.remove(messageId);
|
_packetBuffer.remove(messageId);
|
||||||
|
|
||||||
|
// 解析完整的 payload
|
||||||
if (payloadType == PayloadTypeConstant.talkData) {
|
if (payloadType == PayloadTypeConstant.talkData) {
|
||||||
// 解析完整的 payload
|
|
||||||
final TalkData talkData = TalkData.fromBuffer(completePayload);
|
final TalkData talkData = TalkData.fromBuffer(completePayload);
|
||||||
return talkData;
|
return talkData;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -79,7 +79,7 @@ class StartChartManage {
|
|||||||
int talkDataIntervalTime = 10; // 通话数据的消息间隔(ms)
|
int talkDataIntervalTime = 10; // 通话数据的消息间隔(ms)
|
||||||
Timer? talkDataTimer; // 发送通话数据消息定时器
|
Timer? talkDataTimer; // 发送通话数据消息定时器
|
||||||
|
|
||||||
final int _maxPayloadSize = 1 * 1024; // 分包大小
|
final int _maxPayloadSize = 8 * 1024; // 分包大小
|
||||||
|
|
||||||
// 默认通话的期望数据格式
|
// 默认通话的期望数据格式
|
||||||
TalkExpect defaultTalkExpect = TalkExpect(
|
TalkExpect defaultTalkExpect = TalkExpect(
|
||||||
@ -126,6 +126,7 @@ class StartChartManage {
|
|||||||
FromPeerId = requestStarChartRegisterNode.peer!.id ?? '';
|
FromPeerId = requestStarChartRegisterNode.peer!.id ?? '';
|
||||||
bindUserStarchart();
|
bindUserStarchart();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//绑定星图配置
|
//绑定星图配置
|
||||||
@ -946,12 +947,13 @@ class StartChartManage {
|
|||||||
|
|
||||||
/// 销毁资源
|
/// 销毁资源
|
||||||
void destruction() async {
|
void destruction() async {
|
||||||
|
isOnlineStartChartServer = false;
|
||||||
stopTalkExpectMessageTimer();
|
stopTalkExpectMessageTimer();
|
||||||
stopTalkPingMessageTimer();
|
stopTalkPingMessageTimer();
|
||||||
stopHeartbeat();
|
stopHeartbeat();
|
||||||
stopReStartOnlineStartChartServer();
|
stopReStartOnlineStartChartServer();
|
||||||
stopTalkDataTimer();
|
stopTalkDataTimer();
|
||||||
await Storage.removerRelayInfo();
|
// await Storage.removerRelayInfo();
|
||||||
await Storage.removerStarChartRegisterNodeInfo();
|
// await Storage.removerStarChartRegisterNodeInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user