diff options
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Net/NetworkAdapter.cpp | 4 | ||||
-rw-r--r-- | Kernel/Net/NetworkAdapter.h | 3 | ||||
-rw-r--r-- | Kernel/Net/NetworkTask.cpp | 4 |
3 files changed, 5 insertions, 6 deletions
diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index 96e9bbfe86..191e97044c 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -88,8 +88,8 @@ void NetworkAdapter::did_receive(const u8* data, int length) m_packets_in++; m_bytes_in += length; m_packet_queue.append(KBuffer::copy(data, length)); - if (m_on_receive) - m_on_receive(); + if (on_receive) + on_receive(); } Optional<KBuffer> NetworkAdapter::dequeue_packet() diff --git a/Kernel/Net/NetworkAdapter.h b/Kernel/Net/NetworkAdapter.h index 2eec468452..b063163eed 100644 --- a/Kernel/Net/NetworkAdapter.h +++ b/Kernel/Net/NetworkAdapter.h @@ -45,7 +45,7 @@ public: u32 packets_out() const { return m_packets_out; } u32 bytes_out() const { return m_bytes_out; } - void set_on_receive(Function<void()> on_receive) { m_on_receive = move(on_receive); } + Function<void()> on_receive; protected: NetworkAdapter(); @@ -65,5 +65,4 @@ private: u32 m_bytes_in { 0 }; u32 m_packets_out { 0 }; u32 m_bytes_out { 0 }; - Function<void()> m_on_receive; }; diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index f45bf0d2a9..72938bce74 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -50,9 +50,9 @@ void NetworkTask_main() adapter.ipv4_netmask().to_string().characters(), adapter.ipv4_gateway().to_string().characters()); - adapter.set_on_receive([&pending_packets]() { + adapter.on_receive = [&pending_packets]() { pending_packets++; - }); + }; }); auto dequeue_packet = [&pending_packets]() -> Optional<KBuffer> { |