Commit b24edf52 authored by Jakob Otto's avatar Jakob Otto

Include review feedback

parent b082dec9
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
// -- management ------------------------------------------------------------- // -- management -------------------------------------------------------------
void launch(const node_id& last_hop, const basp::header& hdr, void launch(const node_id& last_hop, const basp::header& hdr,
const buffer_type& payload); span<const byte> payload);
// -- implementation of resumable -------------------------------------------- // -- implementation of resumable --------------------------------------------
......
...@@ -45,9 +45,7 @@ namespace net { ...@@ -45,9 +45,7 @@ namespace net {
namespace basp { namespace basp {
application::application(proxy_registry& proxies) application::application(proxy_registry& proxies)
: proxies_(proxies), : proxies_(proxies), queue_{new message_queue}, hub_{new hub_type} {
queue_{std::unique_ptr<message_queue>{new message_queue}},
hub_{std::unique_ptr<hub_type>{new hub_type}} {
// nop // nop
} }
...@@ -252,12 +250,9 @@ error application::handle_handshake(packet_writer&, header hdr, ...@@ -252,12 +250,9 @@ error application::handle_handshake(packet_writer&, header hdr,
error application::handle_actor_message(packet_writer&, header hdr, error application::handle_actor_message(packet_writer&, header hdr,
byte_span payload) { byte_span payload) {
auto worker = hub_->pop(); auto worker = hub_->pop();
// TODO: This copy is nessecary because the worker interface expects a buffer
// type...
buffer_type buf(payload.begin(), payload.end());
if (worker != nullptr) { if (worker != nullptr) {
CAF_LOG_DEBUG("launch BASP worker for deserializing an actor_message"); CAF_LOG_DEBUG("launch BASP worker for deserializing an actor_message");
worker->launch(node_id{}, hdr, buf); worker->launch(node_id{}, hdr, payload);
} else { } else {
CAF_LOG_DEBUG( CAF_LOG_DEBUG(
"out of BASP workers, continue deserializing an actor_message"); "out of BASP workers, continue deserializing an actor_message");
...@@ -266,7 +261,7 @@ error application::handle_actor_message(packet_writer&, header hdr, ...@@ -266,7 +261,7 @@ error application::handle_actor_message(packet_writer&, header hdr,
struct handler : remote_message_handler<handler> { struct handler : remote_message_handler<handler> {
handler(message_queue* queue, proxy_registry* proxies, handler(message_queue* queue, proxy_registry* proxies,
actor_system* system, node_id last_hop, basp::header& hdr, actor_system* system, node_id last_hop, basp::header& hdr,
buffer_type& payload) byte_span payload)
: queue_(queue), : queue_(queue),
proxies_(proxies), proxies_(proxies),
system_(system), system_(system),
...@@ -280,10 +275,10 @@ error application::handle_actor_message(packet_writer&, header hdr, ...@@ -280,10 +275,10 @@ error application::handle_actor_message(packet_writer&, header hdr,
actor_system* system_; actor_system* system_;
node_id last_hop_; node_id last_hop_;
basp::header& hdr_; basp::header& hdr_;
buffer_type& payload_; byte_span payload_;
uint64_t msg_id_; uint64_t msg_id_;
}; };
handler f{queue_.get(), &proxies_, system_, node_id{}, hdr, buf}; handler f{queue_.get(), &proxies_, system_, node_id{}, hdr, payload};
f.handle_remote_message(&executor_); f.handle_remote_message(&executor_);
} }
return none; return none;
......
...@@ -42,7 +42,7 @@ worker::~worker() { ...@@ -42,7 +42,7 @@ worker::~worker() {
// -- management --------------------------------------------------------------- // -- management ---------------------------------------------------------------
void worker::launch(const node_id& last_hop, const basp::header& hdr, void worker::launch(const node_id& last_hop, const basp::header& hdr,
const buffer_type& payload) { span<const byte> payload) {
msg_id_ = queue_->new_id(); msg_id_ = queue_->new_id();
last_hop_ = last_hop; last_hop_ = last_hop;
memcpy(&hdr_, &hdr, sizeof(basp::header)); memcpy(&hdr_, &hdr, sizeof(basp::header));
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* http://www.boost.org/LICENSE_1_0.txt. * * http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/ ******************************************************************************/
#define CAF_SUITE basp.message_queue #define CAF_SUITE net.basp.message_queue
#include "caf/net/basp/message_queue.hpp" #include "caf/net/basp/message_queue.hpp"
...@@ -31,9 +31,11 @@ using namespace caf; ...@@ -31,9 +31,11 @@ using namespace caf;
namespace { namespace {
behavior testee_impl() { behavior testee_impl() {
return {[](ok_atom, int) { return {
[](ok_atom, int) {
// nop // nop
}}; },
};
} }
struct fixture : test_coordinator_fixture<> { struct fixture : test_coordinator_fixture<> {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* http://www.boost.org/LICENSE_1_0.txt. * * http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/ ******************************************************************************/
#define CAF_SUITE basp.worker #define CAF_SUITE net.basp.worker
#include "caf/net/basp/worker.hpp" #include "caf/net/basp/worker.hpp"
...@@ -35,9 +35,11 @@ using namespace caf; ...@@ -35,9 +35,11 @@ using namespace caf;
namespace { namespace {
behavior testee_impl() { behavior testee_impl() {
return {[](ok_atom) { return {
[](ok_atom) {
// nop // nop
}}; },
};
} }
class mock_actor_proxy : public actor_proxy { class mock_actor_proxy : public actor_proxy {
......
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