Commit 81b8f743 authored by Dominik Charousset's avatar Dominik Charousset

Integrate review feedback

parent 1a359629
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "caf/actor_system.hpp" #include "caf/actor_system.hpp"
#include "caf/actor_system_config.hpp" #include "caf/actor_system_config.hpp"
#include "caf/byte_span.hpp"
#include "caf/event_based_actor.hpp" #include "caf/event_based_actor.hpp"
#include "caf/exec_main.hpp" #include "caf/exec_main.hpp"
#include "caf/ip_endpoint.hpp" #include "caf/ip_endpoint.hpp"
...@@ -105,9 +106,6 @@ public: ...@@ -105,9 +106,6 @@ public:
// We expect a stream-oriented interface to the lower communication layers. // We expect a stream-oriented interface to the lower communication layers.
using input_tag = caf::tag::mixed_message_oriented; using input_tag = caf::tag::mixed_message_oriented;
// Convenience alias.
using byte_span = caf::span<caf::byte>;
// -- constants -------------------------------------------------------------- // -- constants --------------------------------------------------------------
// Restricts our buffer to a maximum of 1MB. // Restricts our buffer to a maximum of 1MB.
...@@ -223,7 +221,7 @@ public: ...@@ -223,7 +221,7 @@ public:
} }
template <class LowerLayerPtr> template <class LowerLayerPtr>
ptrdiff_t consume_binary(LowerLayerPtr down, byte_span) { ptrdiff_t consume_binary(LowerLayerPtr down, caf::byte_span) {
// Reject binary input. // Reject binary input.
auto err = caf::make_error(caf::sec::runtime_error, auto err = caf::make_error(caf::sec::runtime_error,
"received binary WebSocket frame (unsupported)"); "received binary WebSocket frame (unsupported)");
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "caf/actor_system.hpp" #include "caf/actor_system.hpp"
#include "caf/actor_system_config.hpp" #include "caf/actor_system_config.hpp"
#include "caf/byte.hpp" #include "caf/byte.hpp"
#include "caf/byte_span.hpp"
#include "caf/callback.hpp" #include "caf/callback.hpp"
#include "caf/defaults.hpp" #include "caf/defaults.hpp"
#include "caf/detail/net_export.hpp" #include "caf/detail/net_export.hpp"
...@@ -57,8 +58,6 @@ class CAF_NET_EXPORT application { ...@@ -57,8 +58,6 @@ class CAF_NET_EXPORT application {
public: public:
// -- member types ----------------------------------------------------------- // -- member types -----------------------------------------------------------
using byte_span = span<byte>;
using hub_type = detail::worker_hub<worker>; using hub_type = detail::worker_hub<worker>;
struct test_tag {}; struct test_tag {};
......
...@@ -53,9 +53,9 @@ public: ...@@ -53,9 +53,9 @@ public:
std::vector<strong_actor_ptr> fwd_stack; std::vector<strong_actor_ptr> fwd_stack;
message content; message content;
binary_deserializer source{ctx, payload}; binary_deserializer source{ctx, payload};
if (auto err = source.apply_objects(src_node, src_id, dst_id, fwd_stack, if (!source.apply_objects(src_node, src_id, dst_id, fwd_stack, content)) {
content)) { CAF_LOG_ERROR(
CAF_LOG_ERROR("could not deserialize payload: " << CAF_ARG(err)); "failed to deserialize payload:" << CAF_ARG(source.get_error()));
return; return;
} }
// Sanity checks. // Sanity checks.
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
error init(socket_manager* owner, ParentPtr parent, const settings& config) { error init(socket_manager* owner, ParentPtr parent, const settings& config) {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
owner_ = owner; owner_ = owner;
cfg_ = config;
if (auto err = factory_.init(owner, config)) if (auto err = factory_.init(owner, config))
return err; return err;
parent->register_reading(); parent->register_reading();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <memory> #include <memory>
#include "caf/byte.hpp" #include "caf/byte.hpp"
#include "caf/byte_span.hpp"
#include "caf/detail/network_order.hpp" #include "caf/detail/network_order.hpp"
#include "caf/error.hpp" #include "caf/error.hpp"
#include "caf/net/receive_policy.hpp" #include "caf/net/receive_policy.hpp"
...@@ -41,8 +42,6 @@ namespace caf::net { ...@@ -41,8 +42,6 @@ namespace caf::net {
template <class UpperLayer> template <class UpperLayer>
class length_prefix_framing { class length_prefix_framing {
public: public:
using byte_span = span<byte>;
using input_tag = tag::stream_oriented; using input_tag = tag::stream_oriented;
using output_tag = tag::message_oriented; using output_tag = tag::message_oriented;
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
namespace caf::net { namespace caf::net {
/// Wraps a pointer to a stream-oriented layer with a pointer to its lower /// Wraps a pointer to a mixed-message-oriented layer with a pointer to its
/// layer. Both pointers are then used to implement the interface required for a /// lower layer. Both pointers are then used to implement the interface required
/// mixed-message-oriented layer when calling into its upper layer. /// for a mixed-message-oriented layer when calling into its upper layer.
template <class Layer, class LowerLayerPtr> template <class Layer, class LowerLayerPtr>
class mixed_message_oriented_layer_ptr { class mixed_message_oriented_layer_ptr {
public: public:
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#pragma once #pragma once
#include "caf/byte.hpp" #include "caf/byte.hpp"
#include "caf/byte_span.hpp"
#include "caf/detail/rfc6455.hpp" #include "caf/detail/rfc6455.hpp"
#include "caf/net/mixed_message_oriented_layer_ptr.hpp" #include "caf/net/mixed_message_oriented_layer_ptr.hpp"
#include "caf/sec.hpp" #include "caf/sec.hpp"
...@@ -39,8 +40,6 @@ class web_socket_framing { ...@@ -39,8 +40,6 @@ class web_socket_framing {
public: public:
// -- member types ----------------------------------------------------------- // -- member types -----------------------------------------------------------
using byte_span = span<byte>;
using binary_buffer = std::vector<byte>; using binary_buffer = std::vector<byte>;
using text_buffer = std::vector<char>; using text_buffer = std::vector<char>;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <algorithm> #include <algorithm>
#include "caf/byte_span.hpp"
#include "caf/detail/encode_base64.hpp" #include "caf/detail/encode_base64.hpp"
#include "caf/error.hpp" #include "caf/error.hpp"
#include "caf/hash/sha1.hpp" #include "caf/hash/sha1.hpp"
...@@ -42,8 +43,6 @@ class web_socket_server { ...@@ -42,8 +43,6 @@ class web_socket_server {
public: public:
// -- member types ----------------------------------------------------------- // -- member types -----------------------------------------------------------
using byte_span = span<byte>;
using input_tag = tag::stream_oriented; using input_tag = tag::stream_oriented;
using output_tag = tag::mixed_message_oriented; using output_tag = tag::mixed_message_oriented;
......
...@@ -20,10 +20,6 @@ ...@@ -20,10 +20,6 @@
namespace caf::tag { namespace caf::tag {
class mixed_message_oriented { struct mixed_message_oriented {};
public:
mixed_message_oriented();
~mixed_message_oriented();
};
} // namespace caf::tag } // namespace caf::tag
...@@ -55,9 +55,6 @@ template <int Family> ...@@ -55,9 +55,6 @@ template <int Family>
expected<tcp_accept_socket> new_tcp_acceptor_impl(uint16_t port, expected<tcp_accept_socket> new_tcp_acceptor_impl(uint16_t port,
const char* addr, const char* addr,
bool reuse_addr, bool any) { bool reuse_addr, bool any) {
auto bts = [](bool x) { return x ? "true" : "false"; };
printf("%s(%d, %s, %s, %s)\n", __func__, (int) port, addr, bts(reuse_addr),
bts(any));
static_assert(Family == AF_INET || Family == AF_INET6, "invalid family"); static_assert(Family == AF_INET || Family == AF_INET6, "invalid family");
CAF_LOG_TRACE(CAF_ARG(port) << ", addr = " << (addr ? addr : "nullptr")); CAF_LOG_TRACE(CAF_ARG(port) << ", addr = " << (addr ? addr : "nullptr"));
int socktype = SOCK_STREAM; int socktype = SOCK_STREAM;
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "net-test.hpp" #include "net-test.hpp"
#include "caf/byte.hpp"
#include "caf/byte_span.hpp"
#include "caf/callback.hpp" #include "caf/callback.hpp"
#include "caf/net/middleman.hpp" #include "caf/net/middleman.hpp"
#include "caf/net/socket_guard.hpp" #include "caf/net/socket_guard.hpp"
...@@ -34,8 +36,6 @@ using namespace std::string_literals; ...@@ -34,8 +36,6 @@ using namespace std::string_literals;
namespace { namespace {
using byte_span = span<byte>;
using svec = std::vector<std::string>; using svec = std::vector<std::string>;
struct app_t { struct app_t {
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "caf/binary_serializer.hpp" #include "caf/binary_serializer.hpp"
#include "caf/byte.hpp" #include "caf/byte.hpp"
#include "caf/byte_buffer.hpp" #include "caf/byte_buffer.hpp"
#include "caf/byte_span.hpp"
#include "caf/detail/network_order.hpp" #include "caf/detail/network_order.hpp"
#include "caf/span.hpp" #include "caf/span.hpp"
#include "caf/tag/message_oriented.hpp" #include "caf/tag/message_oriented.hpp"
...@@ -40,8 +41,6 @@ namespace { ...@@ -40,8 +41,6 @@ namespace {
/// upper layer: expect messages /// upper layer: expect messages
/// Needs to be initilized by the layer two steps down. /// Needs to be initilized by the layer two steps down.
struct ul_expect_messages { struct ul_expect_messages {
using byte_span = span<byte>;
using input_tag = tag::message_oriented; using input_tag = tag::message_oriented;
void set_expected_messages(std::vector<byte_buffer> messages) { void set_expected_messages(std::vector<byte_buffer> messages) {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "net-test.hpp" #include "net-test.hpp"
#include "caf/byte_span.hpp"
#include "caf/net/multiplexer.hpp" #include "caf/net/multiplexer.hpp"
#include "caf/net/socket_manager.hpp" #include "caf/net/socket_manager.hpp"
#include "caf/net/stream_socket.hpp" #include "caf/net/stream_socket.hpp"
...@@ -33,8 +34,6 @@ using namespace std::literals::string_literals; ...@@ -33,8 +34,6 @@ using namespace std::literals::string_literals;
namespace { namespace {
using byte_span = span<byte>;
using svec = std::vector<std::string>; using svec = std::vector<std::string>;
struct app_t { struct app_t {
......
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