From 2baa283d871c0eb88fe710f86a77fabb077e1d04 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 9 Mar 2021 09:57:26 +0100 Subject: [PATCH] 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. --- repos/libports/src/lib/vfs/lwip/vfs.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/repos/libports/src/lib/vfs/lwip/vfs.cc b/repos/libports/src/lib/vfs/lwip/vfs.cc index 0c66f26fc9..311df61397 100644 --- a/repos/libports/src/lib/vfs/lwip/vfs.cc +++ b/repos/libports/src/lib/vfs/lwip/vfs.cc @@ -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; }