1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

netstat: Fix in/out bytes not showing

Some change in our JsonObject API broke the logic here. We now read
the correct type from the JsonObject and convert it to a string ourself.
This commit is contained in:
Fabian Dellwing 2023-05-01 19:19:50 +02:00 committed by Jelle Raaijmakers
parent 2efdac9441
commit 34d699b678

View file

@ -171,8 +171,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
for (auto& value : sorted_regions) {
auto& if_object = value.as_object();
auto bytes_in = if_object.get_deprecated_string("bytes_in"sv).value_or({});
auto bytes_out = if_object.get_deprecated_string("bytes_out"sv).value_or({});
auto bytes_in = if_object.get_u32("bytes_in"sv).value_or({});
auto bytes_out = if_object.get_u32("bytes_out"sv).value_or({});
auto peer_address = if_object.get_deprecated_string("peer_address"sv).value_or({});
if (!flag_numeric) {
@ -227,9 +227,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (protocol_column != -1)
columns[protocol_column].buffer = "tcp";
if (bytes_in_column != -1)
columns[bytes_in_column].buffer = bytes_in;
columns[bytes_in_column].buffer = TRY(String::number(bytes_in)).to_deprecated_string();
if (bytes_out_column != -1)
columns[bytes_out_column].buffer = bytes_out;
columns[bytes_out_column].buffer = TRY(String::number(bytes_out)).to_deprecated_string();
if (local_address_column != -1)
columns[local_address_column].buffer = get_formatted_address(local_address, local_port);
if (peer_address_column != -1)