File tree 2 files changed +10
-7
lines changed
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -79,14 +79,17 @@ function chooseLabel() {
79
79
function parseStat ( ) {
80
80
try {
81
81
let input_file = Gio . file_new_for_path ( '/proc/net/dev' ) ;
82
- let fstream = input_file . read ( null ) ;
83
- let dstream = Gio . DataInputStream . new ( fstream ) ;
82
+
83
+ let [ , contents , etag ] = input_file . load_contents ( null ) ;
84
+ contents = byteArrayToString ( contents ) ;
85
+ let lines = contents . split ( '\n' ) ;
84
86
85
87
let count = 0 ;
86
88
let countUp = 0 ;
87
89
let line ;
88
- while ( ( [ line , len ] = dstream . read_line ( null ) ) != null && line != null ) {
89
- line = byteArrayToString ( line ) ;
90
+
91
+ for ( let i = 0 ; i < lines . length ; i ++ ) {
92
+ line = lines [ i ] ;
90
93
line = line . trim ( ) ;
91
94
let fields = line . split ( / \W + / ) ;
92
95
if ( fields . length <= 2 ) break ;
@@ -104,7 +107,6 @@ function parseStat() {
104
107
countUp = countUp + parseInt ( fields [ 9 ] ) ;
105
108
}
106
109
}
107
- fstream . close ( null ) ;
108
110
109
111
if ( lastCount === 0 ) lastCount = count ;
110
112
if ( lastCountUp === 0 ) lastCountUp = countUp ;
Original file line number Diff line number Diff line change 9
9
" 3.38" ,
10
10
" 40" ,
11
11
" 41" ,
12
- " 42"
12
+ " 42" ,
13
+ " 43"
13
14
],
14
15
"url" : " https://github.com/biji/simplenetspeed" ,
15
16
16
- "version" : 28
17
+ "version" : 29
17
18
}
You can’t perform that action at this time.
0 commit comments