fix:增加echo调试代码

This commit is contained in:
liyi 2024-12-23 17:13:32 +08:00
parent eadd667511
commit ffda80fb01
3 changed files with 37 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -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 {

View File

@ -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();
} }
} }