Commit 680be0d1 authored by Jakob Otto's avatar Jakob Otto

Add using id_type = ...

parent 8510b2a3
......@@ -47,6 +47,8 @@ class datagram_transport {
public:
// -- member types -----------------------------------------------------------
using id_type = ip_endpoint;
using buffer_type = std::vector<byte>;
using buffer_cache_type = std::vector<buffer_type>;
......@@ -55,8 +57,7 @@ public:
using transport_type = datagram_transport<Factory>;
using dispatcher_type = transport_worker_dispatcher<transport_type,
ip_endpoint>;
using dispatcher_type = transport_worker_dispatcher<transport_type, id_type>;
using application_type = typename Factory::application_type;
......@@ -169,15 +170,15 @@ public:
dispatcher_.timeout(*this, value, id);
}
void set_timeout(uint64_t timeout_id, ip_endpoint ep) {
dispatcher_.set_timeout(timeout_id, ep);
void set_timeout(uint64_t timeout_id, id_type id) {
dispatcher_.set_timeout(timeout_id, id);
}
void handle_error(sec code) {
dispatcher_.handle_error(code);
}
error add_new_worker(node_id node, ip_endpoint id) {
error add_new_worker(node_id node, id_type id) {
return dispatcher_.add_new_worker(*this, node, id);
}
......@@ -214,13 +215,13 @@ public:
prepare_next_read();
}
void write_packet(ip_endpoint ep, span<buffer_type*> buffers) {
void write_packet(id_type id, span<buffer_type*> buffers) {
CAF_ASSERT(!buffers.empty());
if (packet_queue_.empty())
manager().register_writing();
// By convention, the first buffer is a header buffer. Every other buffer is
// a payload buffer.
packet_queue_.emplace_back(ep, buffers);
packet_queue_.emplace_back(id, buffers);
}
// -- buffer management ------------------------------------------------------
......@@ -235,12 +236,11 @@ public:
/// Helper struct for managing outgoing packets
struct packet {
ip_endpoint destination;
id_type id;
buffer_cache_type bytes;
size_t size;
packet(ip_endpoint destination, span<buffer_type*> bufs)
: destination(destination) {
packet(id_type id, span<buffer_type*> bufs) : id(id) {
size = 0;
for (auto buf : bufs) {
size += buf->size();
......@@ -286,7 +286,7 @@ private:
std::vector<std::vector<byte>*> ptrs;
for (auto& buf : packet.bytes)
ptrs.emplace_back(&buf);
auto write_ret = write(handle_, make_span(ptrs), packet.destination);
auto write_ret = write(handle_, make_span(ptrs), packet.id);
if (auto num_bytes = get_if<size_t>(&write_ret)) {
CAF_LOG_DEBUG(CAF_ARG(handle_.id) << CAF_ARG(*num_bytes));
CAF_LOG_WARNING_IF(*num_bytes < packet.size,
......
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