Commit e91d0539 authored by Jakob Otto's avatar Jakob Otto

Include review feedback

parent d4df45ed
...@@ -137,7 +137,8 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) { ...@@ -137,7 +137,8 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
// get a 'named' actor from local registry // get a 'named' actor from local registry
[=](get_atom, atom_value name) { [=](get_atom, atom_value name) {
return self->home_system().registry().get(name); return self->home_system().registry().get(name);
}}; },
};
} }
// -- spawn server ------------------------------------------------------------- // -- spawn server -------------------------------------------------------------
...@@ -154,12 +155,14 @@ const char* spawn_serv_state::name = "spawn_server"; ...@@ -154,12 +155,14 @@ const char* spawn_serv_state::name = "spawn_server";
behavior spawn_serv_impl(stateful_actor<spawn_serv_state>* self) { behavior spawn_serv_impl(stateful_actor<spawn_serv_state>* self) {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
return {[=](spawn_atom, const std::string& name, message& args, return {
actor_system::mpi& xs) -> expected<strong_actor_ptr> { [=](spawn_atom, const std::string& name, message& args,
CAF_LOG_TRACE(CAF_ARG(name) << CAF_ARG(args)); actor_system::mpi& xs) -> expected<strong_actor_ptr> {
return self->system().spawn<strong_actor_ptr>(name, std::move(args), CAF_LOG_TRACE(CAF_ARG(name) << CAF_ARG(args));
self->context(), true, &xs); return self->system().spawn<strong_actor_ptr>(name, std::move(args),
}}; self->context(), true, &xs);
},
};
} }
// -- stream server ------------------------------------------------------------ // -- stream server ------------------------------------------------------------
......
...@@ -44,8 +44,12 @@ std::string encode_base64(const string& str) { ...@@ -44,8 +44,12 @@ std::string encode_base64(const string& str) {
std::string result; std::string result;
// consumes three characters from input // consumes three characters from input
auto consume = [&](const char* i) { auto consume = [&](const char* i) {
int buf[]{(i[0] & 0xfc) >> 2, ((i[0] & 0x03) << 4) + ((i[1] & 0xf0) >> 4), int buf[]{
((i[1] & 0x0f) << 2) + ((i[2] & 0xc0) >> 6), i[2] & 0x3f}; (i[0] & 0xfc) >> 2,
((i[0] & 0x03) << 4) + ((i[1] & 0xf0) >> 4),
((i[1] & 0x0f) << 2) + ((i[2] & 0xc0) >> 6),
i[2] & 0x3f,
};
for (auto x : buf) for (auto x : buf)
result += base64_tbl[x]; result += base64_tbl[x];
}; };
...@@ -70,7 +74,7 @@ public: ...@@ -70,7 +74,7 @@ public:
std::string host; std::string host;
int cpu_slots; int cpu_slots;
host_desc(std::string host_addr, int slots, string cldevices) host_desc(std::string host_addr, int slots)
: host(std::move(host_addr)), cpu_slots(slots) { : host(std::move(host_addr)), cpu_slots(slots) {
// nop // nop
} }
...@@ -80,7 +84,7 @@ public: ...@@ -80,7 +84,7 @@ public:
host_desc& operator=(host_desc&&) = default; host_desc& operator=(host_desc&&) = default;
host_desc& operator=(const host_desc&) = default; host_desc& operator=(const host_desc&) = default;
static void append(vector<host_desc>& xs, const string& line, size_t num) { static void append(vector<host_desc>& xs, const string& line) {
vector<string> fields; vector<string> fields;
split(fields, line, is_any_of(" "), token_compress_on); split(fields, line, is_any_of(" "), token_compress_on);
if (fields.empty()) if (fields.empty())
...@@ -99,9 +103,8 @@ std::vector<host_desc> read_hostfile(const string& fname) { ...@@ -99,9 +103,8 @@ std::vector<host_desc> read_hostfile(const string& fname) {
std::vector<host_desc> result; std::vector<host_desc> result;
std::ifstream in{fname}; std::ifstream in{fname};
std::string line; std::string line;
size_t line_num = 0;
while (std::getline(in, line)) while (std::getline(in, line))
host_desc::append(result, line, ++line_num); host_desc::append(result, line);
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