mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: LoopbackAdapter::create() => try_create()
Allow this to fail (although we VERIFY that it succeeds during boot for now, since we don't want to boot without a loopback adapter.)
This commit is contained in:
parent
e4dfb0fdf3
commit
241bbce264
Notes:
sideshowbarker
2024-07-18 09:19:15 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/241bbce264f
3 changed files with 6 additions and 5 deletions
|
@ -11,9 +11,9 @@ namespace Kernel {
|
|||
|
||||
static bool s_loopback_initialized = false;
|
||||
|
||||
NonnullRefPtr<LoopbackAdapter> LoopbackAdapter::create()
|
||||
RefPtr<LoopbackAdapter> LoopbackAdapter::try_create()
|
||||
{
|
||||
return adopt_ref(*new LoopbackAdapter());
|
||||
return adopt_ref_if_nonnull(new LoopbackAdapter());
|
||||
}
|
||||
|
||||
LoopbackAdapter::LoopbackAdapter()
|
||||
|
|
|
@ -17,7 +17,7 @@ private:
|
|||
LoopbackAdapter();
|
||||
|
||||
public:
|
||||
static NonnullRefPtr<LoopbackAdapter> create();
|
||||
static RefPtr<LoopbackAdapter> try_create();
|
||||
virtual ~LoopbackAdapter() override;
|
||||
|
||||
virtual void send_raw(ReadonlyBytes) override;
|
||||
|
|
|
@ -101,8 +101,9 @@ bool NetworkingManagement::initialize()
|
|||
m_adapters.append(adapter.release_nonnull());
|
||||
});
|
||||
}
|
||||
auto loopback = LoopbackAdapter::create();
|
||||
m_adapters.append(loopback);
|
||||
auto loopback = LoopbackAdapter::try_create();
|
||||
VERIFY(loopback);
|
||||
m_adapters.append(*loopback);
|
||||
m_loopback_adapter = loopback;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue