Commit 500835b0 authored by Dominik Charousset's avatar Dominik Charousset

Add missing include and restrict write wakeups

parent 48c2ff93
...@@ -23,7 +23,9 @@ public: ...@@ -23,7 +23,9 @@ public:
} }
void on_producer_wakeup() override { void on_producer_wakeup() override {
mgr_->mpx().register_writing(mgr_); mgr_->mpx().schedule_fn([adapter = strong_this()] { //
adapter->on_wakeup();
});
} }
void ref_consumer() const noexcept override { void ref_consumer() const noexcept override {
...@@ -76,6 +78,15 @@ private: ...@@ -76,6 +78,15 @@ private:
// nop // nop
} }
auto strong_this() {
return intrusive_ptr{this};
}
void on_wakeup() {
if (has_data())
mgr_->mpx().register_writing(mgr_);
}
intrusive_ptr<socket_manager> mgr_; intrusive_ptr<socket_manager> mgr_;
intrusive_ptr<Buffer> buf_; intrusive_ptr<Buffer> buf_;
}; };
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include "caf/action.hpp"
#include "caf/detail/net_export.hpp" #include "caf/detail/net_export.hpp"
#include "caf/net/fwd.hpp" #include "caf/net/fwd.hpp"
#include "caf/net/operation.hpp" #include "caf/net/operation.hpp"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment