vfs_lwip: reduce repeated warnings

This patch avoids the repeated warning "read blocked until lwIP
interface is ready" by printing the message only once. Otherwise,
the log is flooded with those warnings when falkon web browser
is started on Sculpt OS without network connectivity.
This commit is contained in:
Norman Feske 2021-03-09 09:57:26 +01:00
parent 4a12b5c653
commit 2baa283d87

View File

@ -1804,6 +1804,8 @@ class Lwip::File_system final : public Vfs::File_system, public Lwip::Directory
static bool match_nameserver(char const *name) {
return (!strcmp(name, "nameserver")); }
bool _read_blocked_warning_printed_once = false;
public:
File_system(Vfs::Env &vfs_env, Genode::Xml_node config)
@ -2029,10 +2031,16 @@ class Lwip::File_system final : public Vfs::File_system, public Lwip::Directory
*/
bool queue_read(Vfs_handle *vfs_handle, file_size) override
{
if (_netif.ready()) return true;
if (_netif.ready())
return true;
/* handle must be woken up when the interface comes up */
if (!_read_blocked_warning_printed_once) {
Genode::warning("read blocked until lwIP interface is ready");
_read_blocked_warning_printed_once = true;
}
/* handle must be woken when the interface comes up */
Genode::warning("read blocked until lwIP interface is ready");
_netif.enqueue(*vfs_handle);
return false;
}