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

Integrate review feedback

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