monitor: remove terminal write busy loop

Fixes #5011
This commit is contained in:
Christian Prochaska 2023-09-26 12:54:01 +02:00 committed by Christian Helmuth
parent 529cdc949b
commit 7731e02a20
2 changed files with 8 additions and 9 deletions

View File

@ -346,7 +346,9 @@ struct qXfer : Command_with_separator
static Window from_args(Const_byte_range_ptr const &args)
{
return { .offset = comma_separated_hex_value(args, 0, 0UL),
.len = comma_separated_hex_value(args, 1, 0UL) };
/* terminal_crosslink currently buffers 4096 bytes */
.len = min(comma_separated_hex_value(args, 1, 0UL),
2048UL) };
}
};

View File

@ -133,14 +133,11 @@ struct Monitor::Main : Sandbox::State_handler,
Terminal::Connection &_terminal;
void operator () (char const *str)
{
for (;;) {
size_t const num_bytes = strlen(str);
size_t const written_bytes = _terminal.write(str, num_bytes);
if (written_bytes == num_bytes)
break;
str = str + written_bytes;
}
size_t const num_bytes = strlen(str);
size_t const written_bytes = _terminal.write(str, num_bytes);
if (written_bytes != num_bytes)
Genode::warning("Could not send the debug response "
"message completely.");
}
} _write_fn;