Commit 85ef2191 authored by Joseph Noir's avatar Joseph Noir

Fix UDP newb client creation and accepting

parent ea6ab1f4
...@@ -149,8 +149,9 @@ struct basp { ...@@ -149,8 +149,9 @@ struct basp {
} }
void prepare_for_sending(io::network::byte_buffer& buf, void prepare_for_sending(io::network::byte_buffer& buf,
size_t hstart, size_t plen) { size_t hstart, size_t offset, size_t plen) {
stream_serializer<charbuf> out{&parent->backend(), buf.data() + hstart, stream_serializer<charbuf> out{&parent->backend(),
buf.data() + hstart + offset,
sizeof(uint32_t)}; sizeof(uint32_t)};
auto len = static_cast<uint32_t>(plen); auto len = static_cast<uint32_t>(plen);
out(len); out(len);
...@@ -310,8 +311,8 @@ struct tcp_protocol ...@@ -310,8 +311,8 @@ struct tcp_protocol
} }
void prepare_for_sending(io::network::byte_buffer& buf, size_t hstart, void prepare_for_sending(io::network::byte_buffer& buf, size_t hstart,
size_t plen) override { size_t offset, size_t plen) override {
impl.prepare_for_sending(buf, hstart, plen); impl.prepare_for_sending(buf, hstart, offset, plen);
} }
}; };
......
This diff is collapsed.
...@@ -182,7 +182,7 @@ struct protocol_policy_base { ...@@ -182,7 +182,7 @@ struct protocol_policy_base {
virtual void write_header(byte_buffer&, header_writer*) = 0; virtual void write_header(byte_buffer&, header_writer*) = 0;
virtual void prepare_for_sending(byte_buffer&, size_t, size_t) = 0; virtual void prepare_for_sending(byte_buffer&, size_t, size_t, size_t) = 0;
}; };
template <class T> template <class T>
...@@ -211,7 +211,7 @@ struct write_handle { ...@@ -211,7 +211,7 @@ struct write_handle {
~write_handle() { ~write_handle() {
// Can we calculate added bytes for datagram things? // Can we calculate added bytes for datagram things?
auto payload_size = buf->size() - (header_start + header_len); auto payload_size = buf->size() - (header_start + header_len);
protocol->prepare_for_sending(*buf, header_start, payload_size); protocol->prepare_for_sending(*buf, header_start, 0, payload_size);
parent->flush(); parent->flush();
} }
}; };
...@@ -308,7 +308,6 @@ struct newb : public extend<scheduled_actor, newb<Message>>::template ...@@ -308,7 +308,6 @@ struct newb : public extend<scheduled_actor, newb<Message>>::template
// -- overridden modifiers of event handler ---------------------------------- // -- overridden modifiers of event handler ----------------------------------
void handle_event(network::operation op) override { void handle_event(network::operation op) override {
//std::cerr << "got event: " << to_string(op) << std::endl;
CAF_PUSH_AID_FROM_PTR(this); CAF_PUSH_AID_FROM_PTR(this);
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
switch (op) { switch (op) {
......
...@@ -111,7 +111,7 @@ struct protocol_policy_impl ...@@ -111,7 +111,7 @@ struct protocol_policy_impl
return impl.write_header(buf, hw); return impl.write_header(buf, hw);
} }
void prepare_for_sending(byte_buffer&, size_t, size_t) override { void prepare_for_sending(byte_buffer&, size_t, size_t, size_t) override {
return; return;
} }
}; };
......
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