mirror of
https://github.com/wownero/cyberwow.git
synced 2026-10-19 16:28:45 +02:00
limit stdout buffer size to 100 lines
This commit is contained in:
@@ -34,4 +34,5 @@ const emuHost = '192.168.10.100';
|
||||
const host = isEmu ? emuHost : '127.0.0.1';
|
||||
|
||||
const int hashLength = 12;
|
||||
const stdoutLineBufferSize = 100;
|
||||
|
||||
|
||||
+15
-8
@@ -24,6 +24,7 @@ import 'dart:io';
|
||||
import 'dart:developer';
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
@@ -136,19 +137,22 @@ class LoadingState extends HookedState {
|
||||
await Future.wait([load(), showBanner()]);
|
||||
}
|
||||
|
||||
SyncingState _next = SyncingState(setState, getNotification, status);
|
||||
SyncingState _next = SyncingState(setState, getNotification);
|
||||
return moveState(_next);
|
||||
}
|
||||
}
|
||||
|
||||
class SyncingState extends HookedState {
|
||||
String stdout;
|
||||
Queue<String> stdout = Queue();
|
||||
bool synced = false;
|
||||
|
||||
SyncingState(f, s, this.stdout) : super (f, s);
|
||||
SyncingState(f, s) : super (f, s);
|
||||
|
||||
void append(String msg) {
|
||||
this.stdout += msg;
|
||||
stdout.addLast(msg);
|
||||
while (stdout.length > config.stdoutLineBufferSize) {
|
||||
stdout.removeFirst();
|
||||
}
|
||||
syncState();
|
||||
}
|
||||
|
||||
@@ -194,7 +198,7 @@ class SyncingState extends HookedState {
|
||||
}
|
||||
|
||||
class SyncedState extends HookedState {
|
||||
String stdout;
|
||||
Queue<String> stdout;
|
||||
int height;
|
||||
Stream<String> processOutput;
|
||||
bool synced = true;
|
||||
@@ -213,7 +217,7 @@ class SyncedState extends HookedState {
|
||||
await for (final line in processOutput) {
|
||||
if (!synced) break;
|
||||
// print('synced: print stdout loop');
|
||||
stdout += line;
|
||||
stdout.addLast(line);
|
||||
log.info(line);
|
||||
}
|
||||
}
|
||||
@@ -252,14 +256,17 @@ class SyncedState extends HookedState {
|
||||
|
||||
|
||||
class ReSyncingState extends HookedState {
|
||||
String stdout;
|
||||
Queue<String> stdout;
|
||||
Stream<String> processOutput;
|
||||
bool synced = false;
|
||||
|
||||
ReSyncingState(f, s, this.stdout, this.processOutput) : super (f, s);
|
||||
|
||||
void append(String msg) {
|
||||
this.stdout += msg;
|
||||
stdout.addLast(msg);
|
||||
while (stdout.length > config.stdoutLineBufferSize) {
|
||||
stdout.removeFirst();
|
||||
}
|
||||
syncState();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ Widget buildReSyncing(BuildContext context, ReSyncingState state) {
|
||||
reverse: true,
|
||||
child: Text
|
||||
(
|
||||
state.stdout,
|
||||
state.stdout.join(),
|
||||
style: TextStyle
|
||||
(
|
||||
fontFamily: 'RobotoMono',
|
||||
|
||||
@@ -53,7 +53,7 @@ Widget buildSyncing(BuildContext context, SyncingState state) {
|
||||
reverse: true,
|
||||
child: Text
|
||||
(
|
||||
state.stdout,
|
||||
state.stdout.join(),
|
||||
style: TextStyle
|
||||
(
|
||||
fontFamily: 'RobotoMono',
|
||||
|
||||
Reference in New Issue
Block a user