Commit 9c128526 authored by Joseph Noir's avatar Joseph Noir

Little bit of clean up

parent a4ad9d7b
...@@ -165,7 +165,7 @@ inspect(Inspector& f, dgram_doorman_closed_msg& x) { ...@@ -165,7 +165,7 @@ inspect(Inspector& f, dgram_doorman_closed_msg& x) {
return f(meta::type_name("dgram_doorman_closed_msg"), x.handle); return f(meta::type_name("dgram_doorman_closed_msg"), x.handle);
} }
/// Signalizes newly disvocerd remote endpoint /// Signalizes newly discovered remote endpoint
/// and the responsible scribe to a {@link broker}. /// and the responsible scribe to a {@link broker}.
struct new_endpoint_msg { struct new_endpoint_msg {
// Handle to the related datagram endpoint. // Handle to the related datagram endpoint.
...@@ -191,7 +191,6 @@ struct new_datagram_msg { ...@@ -191,7 +191,6 @@ struct new_datagram_msg {
dgram_scribe_handle handle; dgram_scribe_handle handle;
// Buffer containing received data. // Buffer containing received data.
std::vector<char> buf; std::vector<char> buf;
// Port of the doorman that accepted the handshake
}; };
/// @relates new_datagram_msg /// @relates new_datagram_msg
......
...@@ -1011,17 +1011,6 @@ default_multiplexer::add_dgram_doorman(abstract_broker* self, ...@@ -1011,17 +1011,6 @@ default_multiplexer::add_dgram_doorman(abstract_broker* self,
//auto endpoint_info = acceptor_.last_sender(); //auto endpoint_info = acceptor_.last_sender();
auto fd = new_dgram_scribe_impl(acceptor_.host(), auto fd = new_dgram_scribe_impl(acceptor_.host(),
acceptor_.port()); acceptor_.port());
/*
{
std::string host;
uint16_t port;
std::tie(host,port) = sender_from_sockaddr(endpoint_info.first,
endpoint_info.second);
std::cerr << "[DDM] New scribe with " << fd << " for " << host
<< ":" << port << "(or " << acceptor_.host() << ":"
<< acceptor_.port() << ")" << std::endl;
}
*/
if (!fd) { if (!fd) {
CAF_LOG_ERROR(CAF_ARG(fd.error())); CAF_LOG_ERROR(CAF_ARG(fd.error()));
return false; return false;
...@@ -1265,15 +1254,6 @@ bool send_datagram(size_t& result, native_socket fd, void* buf, size_t buf_len, ...@@ -1265,15 +1254,6 @@ bool send_datagram(size_t& result, native_socket fd, void* buf, size_t buf_len,
auto sres = ::sendto(fd, reinterpret_cast<socket_send_ptr>(buf), buf_len, auto sres = ::sendto(fd, reinterpret_cast<socket_send_ptr>(buf), buf_len,
no_sigpipe_flag, reinterpret_cast<sockaddr*>(&sa), no_sigpipe_flag, reinterpret_cast<sockaddr*>(&sa),
sa_len); sa_len);
/*
{
std::string host;
uint16_t port;
std::tie(host,port) = sender_from_sockaddr(sa, sa_len);
std::cerr << "[SD] Sent " << sres << " bytes to "
<< host << ":" << port << std::endl;
}
*/
if (is_error(sres, true)) { if (is_error(sres, true)) {
CAF_LOG_ERROR("sendto returned" << CAF_ARG(sres)); CAF_LOG_ERROR("sendto returned" << CAF_ARG(sres));
return false; return false;
...@@ -1289,15 +1269,6 @@ bool receive_datagram(size_t& result, native_socket fd, void* buf, size_t len, ...@@ -1289,15 +1269,6 @@ bool receive_datagram(size_t& result, native_socket fd, void* buf, size_t len,
auto sres = ::recvfrom(fd, buf, len, 0, auto sres = ::recvfrom(fd, buf, len, 0,
reinterpret_cast<struct sockaddr *>(&sa), reinterpret_cast<struct sockaddr *>(&sa),
&sa_len); &sa_len);
/*
{
std::string host;
uint16_t port;
std::tie(host,port) = sender_from_sockaddr(sa, sa_len);
std::cerr << "[RD] Received " << sres << " bytes from "
<< host << ":" << port << std::endl;
}
*/
// TODO: Check if sres > len and do some error handling ... // TODO: Check if sres > len and do some error handling ...
if (is_error(sres, true)) { if (is_error(sres, true)) {
CAF_LOG_ERROR("recvfrom returned" << CAF_ARG(sres)); CAF_LOG_ERROR("recvfrom returned" << CAF_ARG(sres));
...@@ -1803,8 +1774,6 @@ void dgram_acceptor::handle_event(operation op) { ...@@ -1803,8 +1774,6 @@ void dgram_acceptor::handle_event(operation op) {
CAF_LOG_TRACE(CAF_ARG(fd()) << CAF_ARG(op)); CAF_LOG_TRACE(CAF_ARG(fd()) << CAF_ARG(op));
switch (op) { switch (op) {
case operation::read: { case operation::read: {
// incoming message should signify a new remote enpoint
// --> create a new dgram_scribe
// TODO: some idenfification to prevent arbitrary // TODO: some idenfification to prevent arbitrary
// message from creating endpoints? // message from creating endpoints?
size_t rb; size_t rb;
...@@ -1814,14 +1783,6 @@ void dgram_acceptor::handle_event(operation op) { ...@@ -1814,14 +1783,6 @@ void dgram_acceptor::handle_event(operation op) {
passivate(); passivate();
return; return;
} }
{
std::string host;
uint16_t port;
std::tie(host, port) = sender_from_sockaddr(sockaddr_, sockaddr_len_);
// std::cerr << "[ACC] " << fd() << " received message with " << rb
// << " bytes from " << host << ":" << port << std::endl;
}
bytes_read_ = rb; bytes_read_ = rb;
if (rb > 0) { if (rb > 0) {
std::tie(host_,port_) = sender_from_sockaddr(sockaddr_, sockaddr_len_); std::tie(host_,port_) = sender_from_sockaddr(sockaddr_, sockaddr_len_);
......
...@@ -58,7 +58,7 @@ bool dgram_scribe::consume(execution_unit* ctx, const void*, size_t num_bytes) { ...@@ -58,7 +58,7 @@ bool dgram_scribe::consume(execution_unit* ctx, const void*, size_t num_bytes) {
auto result = invoke_mailbox_element(ctx); auto result = invoke_mailbox_element(ctx);
// swap buffer back to stream and implicitly flush wr_buf() // swap buffer back to stream and implicitly flush wr_buf()
msg_buf.swap(buf); msg_buf.swap(buf);
flush(); // <-- TODO: here from scribe, not sure why? flush();
return result; return result;
} }
......
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