diff --git a/src/instance.cpp b/src/instance.cpp index 570a175..4ee3a06 100644 --- a/src/instance.cpp +++ b/src/instance.cpp @@ -245,8 +245,8 @@ struct instance : std::enable_shared_from_this { } static auto spawn(context_impl &ctx, behaviour b, exit_handler eh, - string_view name, const ref &link, env_t env) - -> expected { + string_view name, const ref &link, + env_t env) -> expected { auto pimpl = make_shared(ctx, move(b), move(eh), name, move(env)); pimpl->lifetime_ = pimpl; handle_ref(pimpl->self_ref_) = pimpl->lifetime_; @@ -447,8 +447,8 @@ struct instance : std::enable_shared_from_this { return send_raw(array(std::forward(parms)...)); } - auto spawn_link(behaviour b, string_view name, env_t env) - -> expected { + auto spawn_link(behaviour b, string_view name, + env_t env) -> expected { auto ret = instance::spawn(ctx, move(b), exit_handler{}, name, lifetime_, move(env)); if (not ret) @@ -497,10 +497,10 @@ struct instance : std::enable_shared_from_this { env_t env_; }; -auto deadsend(const buffer &m) -> result { +auto deadsend(const buffer &m, const ref &from) -> result { if (current_instance and !current_instance->is_in_shutdown() and !m("exit", type::more)) { - return to_error(exit_message("DEADSEND", m)); + return to_error(exit_message("DEADSEND", m, ref_m(from))); } return ok(); } @@ -550,15 +550,15 @@ auto spawn(behaviour b, string_view name) -> expected { p.env_); } -auto spawn(behaviour b, string_view name, env_t env) - -> expected { +auto spawn(behaviour b, string_view name, + env_t env) -> expected { auto &p = private_call(); return instance::spawn(p.ctx, move(b), exit_handler{}, name, thespian::ref{}, move(env)); } -auto context::spawn(behaviour b, string_view name, env_t env) - -> expected { +auto context::spawn(behaviour b, string_view name, + env_t env) -> expected { return instance::spawn(impl(*this), move(b), exit_handler{}, name, thespian::ref{}, move(env)); } @@ -576,8 +576,8 @@ auto context::spawn_link(behaviour b, exit_handler eh, string_view name, move(env)); } -auto context::spawn_link(behaviour b, exit_handler eh, string_view name) - -> expected { +auto context::spawn_link(behaviour b, exit_handler eh, + string_view name) -> expected { return spawn_link(move(b), move(eh), name, env_t{}); } @@ -587,8 +587,8 @@ auto self_ref() -> handle & { return private_call().self_ref_; } auto spawn_link(behaviour b, string_view name) -> expected { return private_call().spawn_link(move(b), name); } -auto spawn_link(behaviour b, string_view name, env_t env) - -> expected { +auto spawn_link(behaviour b, string_view name, + env_t env) -> expected { return private_call().spawn_link(move(b), name, move(env)); } auto send_raw(buffer m) -> result { return private_call().send_raw(move(m)); } @@ -826,8 +826,8 @@ struct udp_impl { } } - [[nodiscard]] auto sendto(string_view data, in6_addr ip, port_t port) - -> size_t { + [[nodiscard]] auto sendto(string_view data, in6_addr ip, + port_t port) -> size_t { if (is_trace_enabled_) owner_.env_.trace( array("udp", tag_, "sendto", data, executor::to_string(ip), port)); @@ -867,8 +867,8 @@ auto udp::create(string tag) -> udp { struct file_descriptor_impl { file_descriptor_impl(const file_descriptor_impl &) = delete; file_descriptor_impl(file_descriptor_impl &&) = delete; - auto operator=(const file_descriptor_impl &) - -> file_descriptor_impl & = delete; + auto + operator=(const file_descriptor_impl &) -> file_descriptor_impl & = delete; auto operator=(file_descriptor_impl &&) -> file_descriptor_impl & = delete; file_descriptor_impl(string_view tag, int fd) @@ -961,8 +961,8 @@ struct file_stream_impl { liffile_stream_elock{owner_.lifetime_}]( error_code ec, size_t bytes_written) { if (ec) { - auto _ = - owner_.send("stream", tag_, "write_error", ec.value(), ec.message()); + auto _ = owner_.send("stream", tag_, "write_error", ec.value(), + ec.message()); } else { auto _ = owner_.send("stream", tag_, "write_complete", bytes_written); } @@ -1497,8 +1497,8 @@ struct connection { return ok(); } - static auto start(int fd, const handle &owner, const char *tag) - -> expected { + static auto start(int fd, const handle &owner, + const char *tag) -> expected { return spawn( [fd, owner, tag]() { link(owner); @@ -1736,8 +1736,8 @@ struct acceptor { string listen_path; acceptor(string_view path, mode m, handle o) - : a{::thespian::unx::acceptor::create(tag)}, owner{move(o)}, listen_path{ - path} { + : a{::thespian::unx::acceptor::create(tag)}, owner{move(o)}, + listen_path{path} { a.listen(path, m); } ~acceptor() = default; @@ -1993,8 +1993,8 @@ struct connection { return ok(); } - static auto start(context_impl &ctx, int fd, const string &prompt) - -> expected { + static auto start(context_impl &ctx, int fd, + const string &prompt) -> expected { return spawn( [&ctx, fd, prompt]() { ::thespian::receive( @@ -2050,8 +2050,8 @@ struct acceptor { return ok(); } - static auto start(context_impl &ctx, port_t port, const string &prompt) - -> expected { + static auto start(context_impl &ctx, port_t port, + const string &prompt) -> expected { return spawn( [&ctx, port, prompt]() { ::thespian::receive( @@ -2064,8 +2064,8 @@ struct acceptor { } }; -auto create(context &ctx, port_t port, const string &prompt) - -> expected { +auto create(context &ctx, port_t port, + const string &prompt) -> expected { return acceptor::start(impl(ctx), port, prompt); }