mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 04:00:28 +08:00
refa: report error (#1747)
* refa: report error * remove some reports [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
a797467606
commit
377e430d74
@@ -200,36 +200,7 @@ class LiveMessageStream {
|
||||
// ..d('$logTag ===> TCP连接建立')
|
||||
// ..d('$logTag ===> 发送认证包');
|
||||
_socketSubscription = _channel?.stream.listen(
|
||||
(data) {
|
||||
final header = PackageHeaderRes.fromBytesData(data);
|
||||
if (header != null) {
|
||||
List<int> decompressedData = [];
|
||||
//心跳包回复不用处理
|
||||
if (header.operationCode == 3) return;
|
||||
if (header.operationCode == 8) {
|
||||
_heartBeat();
|
||||
}
|
||||
try {
|
||||
switch (header.protocolVer) {
|
||||
case 0:
|
||||
case 1:
|
||||
_processingData(data);
|
||||
return;
|
||||
case 2:
|
||||
decompressedData = ZLibDecoder().convert(data.sublist(0x10));
|
||||
break;
|
||||
case 3:
|
||||
decompressedData = const BrotliDecoder().convert(
|
||||
data.sublist(0x10),
|
||||
);
|
||||
//debugPrint('Body: ${utf8.decode()}');
|
||||
}
|
||||
_processingData(decompressedData);
|
||||
} catch (e) {
|
||||
if (kDebugMode) rethrow;
|
||||
}
|
||||
}
|
||||
},
|
||||
onData,
|
||||
onDone: close,
|
||||
onError: (_) => close(),
|
||||
);
|
||||
@@ -255,7 +226,7 @@ class LiveMessageStream {
|
||||
_processingData(data.sublist(subHeader.totalSize));
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (_) {
|
||||
if (kDebugMode) rethrow;
|
||||
}
|
||||
}
|
||||
@@ -296,6 +267,37 @@ class LiveMessageStream {
|
||||
_eventListeners.add(func);
|
||||
}
|
||||
|
||||
void onData(dynamic data) {
|
||||
final header = PackageHeaderRes.fromBytesData(data as Uint8List);
|
||||
if (header != null) {
|
||||
List<int> decompressedData = [];
|
||||
//心跳包回复不用处理
|
||||
if (header.operationCode == 3) return;
|
||||
if (header.operationCode == 8) {
|
||||
_heartBeat();
|
||||
}
|
||||
try {
|
||||
switch (header.protocolVer) {
|
||||
case 0:
|
||||
case 1:
|
||||
_processingData(data);
|
||||
return;
|
||||
case 2:
|
||||
decompressedData = ZLibDecoder().convert(data.sublist(0x10));
|
||||
break;
|
||||
case 3:
|
||||
decompressedData = const BrotliDecoder().convert(
|
||||
data.sublist(0x10),
|
||||
);
|
||||
//debugPrint('Body: ${utf8.decode()}');
|
||||
}
|
||||
_processingData(decompressedData);
|
||||
} catch (_) {
|
||||
if (kDebugMode) rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void close() {
|
||||
_active = false;
|
||||
if (kDebugMode) logger.i("$logTag close $hashCode");
|
||||
|
||||
Reference in New Issue
Block a user