Commit 496df4fe authored by louiz’'s avatar louiz’

Fix a few trivial stuf on the network module

parent 948a1b1b
......@@ -30,6 +30,7 @@ protected:
OccupantsHandler occupants_handler;
TurnHandler turn_handler;
private:
Game(const Game&) = delete;
Game(Game&&) = delete;
Game& operator=(const Game&) = delete;
......
......@@ -19,11 +19,11 @@ MasterToClientServer::MasterToClientServer(MasterServer* master,
const RemoteClient* MasterToClientServer::find_client_by_login(const std::string& login) const
{
for (const RemoteClient* client: this->clients)
for (const auto& client: this->clients)
{
const auto user = client->get_user();
if (user && user->login == login)
return client;
return client.get();
}
return nullptr;
}
......
......@@ -126,8 +126,8 @@ void IPCEndpoint::watch_read()
log_debug("Ready to read");
auto res = this->recv();
this->read_cb(res);
}
this->watch_read();
}
};
this->stream_descriptor.async_read_some(boost::asio::null_buffers(),
cb);
......
......@@ -2,7 +2,7 @@
#include <assert.h>
Message::Message():
body(0),
body(nullptr),
body_size(0),
callback(nullptr)
{
......@@ -35,7 +35,7 @@ void Message::set_body(const google::protobuf::Message& msg)
const int size = msg.ByteSize();
this->body = new char[size];
this->set_body_size(size);
const auto res = msg.SerializeToArray(this->body, size);
const auto&& res = msg.SerializeToArray(this->body, size);
log_debug("Setting message body with protobuf: " << msg.ShortDebugString());
assert(res);
}
......
......@@ -47,7 +47,6 @@ public:
std::placeholders::_2));
}
/**
* called when there's something to read on the socket. Reads the message
* the size of the arguments, and then calls binary_read_handler to read
......
......@@ -74,7 +74,7 @@ public:
return ;
}
if (this->timeout.expires_from_now(boost::chrono::milliseconds(t)) == 0)
if (this->timeout.expires_from_now(boost::asio::steady_timer::duration(t)) == 0)
// The last run_one() call returned because the timeout expired, so
// we reinstall it. If that's not the case
// (something actually happened on the socket)
......
#include <iostream>
#include <logging/logging.hpp>
#include <network/transfer_sender.hpp>
#include <master_server/remote_client.hpp>
#include <network/message.hpp>
#include <network/message_handler.hpp>
#include <network/tls_socket.hpp>
using namespace std::string_literals;
......
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