summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorConrad Pankoff <deoxxa@fknsrs.biz>2019-08-28 22:14:38 +1000
committerAndreas Kling <awesomekling@gmail.com>2019-08-29 06:25:06 +0200
commit498f8c01a2c90e41c9f322ecf2c4202f0cb241e9 (patch)
tree50c7a86799d639eb99d3d3fba3be6b67cca1b232 /Kernel
parent6d1418aa7ad008bff949827fd6a66cb5092665c7 (diff)
downloadserenity-498f8c01a2c90e41c9f322ecf2c4202f0cb241e9.zip
Kernel: Use a public member for NetworkAdapter on_receive
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Net/NetworkAdapter.cpp4
-rw-r--r--Kernel/Net/NetworkAdapter.h3
-rw-r--r--Kernel/Net/NetworkTask.cpp4
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> {