Commit b0e93f0e authored by Dominik Charousset's avatar Dominik Charousset

Update CAF tag, remove legacy API

parent 823b8ad1
......@@ -45,18 +45,6 @@ public:
return *this;
}
// -- timeout management -----------------------------------------------------
template <class... Ts>
uint64_t
set_timeout(actor_clock::time_point tp, std::string type, Ts&&... xs) {
auto act = actor_cast<abstract_actor*>(timeout_proxy_);
CAF_ASSERT(act != nullptr);
sys_.clock().set_multi_timeout(tp, act, std::move(type), next_timeout_id_);
transport_.set_timeout(next_timeout_id_, std::forward<Ts>(xs)...);
return next_timeout_id_++;
}
// -- interface functions ----------------------------------------------------
error init() /*override*/ {
......
......@@ -51,17 +51,6 @@ public:
return transport().next_payload_buffer();
}
// -- member functions -------------------------------------------------------
void cancel_timeout(std::string tag, uint64_t id) {
parent_.cancel_timeout(std::move(tag), id);
}
template <class... Ts>
uint64_t set_timeout(timestamp tout, std::string tag, Ts&&... xs) {
return parent_.set_timeout(tout, std::move(tag), std::forward<Ts>(xs)...);
}
protected:
void write_impl(span<byte_buffer*> buffers) override {
parent_.write_packet(object_.id(), buffers);
......
......@@ -133,24 +133,6 @@ public:
next_layer_.local_actor_down(*this, peer, id, std::move(reason));
}
/// Notifies the transport that the timeout identified by `value` plus `id`
/// was triggered.
/// @param tag The type tag of the timeout.
/// @param id The timeout id of the timeout.
void timeout(endpoint_manager&, std::string tag, uint64_t id) {
next_layer_.timeout(*this, std::move(tag), id);
}
/// Callback for setting a timeout. Will be called after setting a timeout to
/// get the timeout id for local use.
/// @param timeout_id The id of the previously set timeout.
/// @param ts Any further information that was passed when setting the
/// timeout.
template <class... Ts>
void set_timeout(uint64_t timeout_id, Ts&&... ts) {
next_layer_.set_timeout(timeout_id, std::forward<Ts>(ts)...);
}
/// Callback for when an error occurs.
/// @param code The error code to handle.
void handle_error(sec code) {
......
......@@ -97,19 +97,6 @@ public:
worker->local_actor_down(parent, nid, id, std::move(reason));
}
template <class... Ts>
void set_timeout(uint64_t timeout_id, id_type id, Ts&&...) {
workers_by_timeout_id_.emplace(timeout_id, workers_by_id_.at(id));
}
template <class Parent>
void timeout(Parent& parent, std::string tag, uint64_t id) {
if (auto worker = workers_by_timeout_id_.at(id)) {
worker->timeout(parent, std::move(tag), id);
workers_by_timeout_id_.erase(id);
}
}
void handle_error(sec error) {
for (const auto& p : workers_by_id_) {
auto worker = p.second;
......
......@@ -254,13 +254,6 @@ struct fixture : host_fixture {
memcmp(buf->data() + 1, hello_test.data(), hello_test.size()), 0); \
buf->clear();
#define CHECK_TIMEOUT(testcase) \
dispatcher.set_timeout(1u, testcase.ep); \
dispatcher.timeout(dummy, "dummy", 1u); \
CAF_CHECK_EQUAL(buf->size(), 1u); \
CAF_CHECK_EQUAL(static_cast<byte>(testcase.worker_id), buf->at(0)); \
buf->clear();
} // namespace
CAF_TEST_FIXTURE_SCOPE(transport_worker_dispatcher_test, fixture)
......@@ -288,13 +281,6 @@ CAF_TEST(resolve) {
// TODO think of a test for this
}
CAF_TEST(timeout) {
CHECK_TIMEOUT(test_data.at(0));
CHECK_TIMEOUT(test_data.at(1));
CHECK_TIMEOUT(test_data.at(2));
CHECK_TIMEOUT(test_data.at(3));
}
CAF_TEST(handle_error) {
dispatcher.handle_error(sec::unavailable_or_would_block);
CAF_CHECK_EQUAL(buf->size(), 4u);
......
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