Commit 4bf5c01f authored by neverlord's avatar neverlord

small bugfixes

parent d7088d90
...@@ -90,6 +90,11 @@ class abstract_actor /*[[base_check]]*/ : public Base ...@@ -90,6 +90,11 @@ class abstract_actor /*[[base_check]]*/ : public Base
// lifetime scope of guard // lifetime scope of guard
{ {
std::lock_guard<std::mutex> guard(m_mtx); std::lock_guard<std::mutex> guard(m_mtx);
if (m_exit_reason != exit_reason::not_exited)
{
// already exited
return;
}
m_exit_reason = reason; m_exit_reason = reason;
mlinks = std::move(m_links); mlinks = std::move(m_links);
mattachables = std::move(m_attachables); mattachables = std::move(m_attachables);
......
...@@ -107,7 +107,21 @@ class single_reader_queue ...@@ -107,7 +107,21 @@ class single_reader_queue
return !m_head && !(m_tail.load()); return !m_head && !(m_tail.load());
} }
single_reader_queue() : m_tail(0), m_head(0) { } single_reader_queue() : m_tail(nullptr), m_head(nullptr)
{
}
~single_reader_queue()
{
fetch_new_data();
element_type* e = m_head;
while (e)
{
element_type* tmp = e;
e = e->next;
delete tmp;
}
}
private: private:
......
...@@ -102,17 +102,9 @@ class local_group_module : public group::module ...@@ -102,17 +102,9 @@ class local_group_module : public group::module
{ {
upgrade_guard uguard(guard); upgrade_guard uguard(guard);
auto p = m_instances.insert(std::make_pair(group_name, tmp)); auto p = m_instances.insert(std::make_pair(group_name, tmp));
if (p.second == false) // someone might preempt us
{
// someone preempt us
return p.first->second; return p.first->second;
} }
else
{
// ok, inserted tmp
return tmp;
}
}
} }
} }
......
...@@ -48,21 +48,21 @@ cppa::process_information compute_proc_info() ...@@ -48,21 +48,21 @@ cppa::process_information compute_proc_info()
char cbuf[100]; char cbuf[100];
// fetch hd serial // fetch hd serial
std::string hd_serial; std::string hd_serial;
FILE* cmd = popen(s_get_uuid, "r"); FILE* get_uuid_cmd = popen(s_get_uuid, "r");
while (fgets(cbuf, 100, cmd) != 0) while (fgets(cbuf, 100, get_uuid_cmd) != 0)
{ {
hd_serial += cbuf; hd_serial += cbuf;
} }
pclose(cmd); pclose(get_uuid_cmd);
erase_trailing_newline(hd_serial); erase_trailing_newline(hd_serial);
// fetch mac address of first network device // fetch mac address of first network device
std::string first_mac_addr; std::string first_mac_addr;
cmd = popen(s_get_mac, "r"); FILE* get_mac_cmd = popen(s_get_mac, "r");
while (fgets(cbuf, 100, cmd) != 0) while (fgets(cbuf, 100, get_mac_cmd) != 0)
{ {
first_mac_addr += cbuf; first_mac_addr += cbuf;
} }
pclose(cmd); pclose(get_mac_cmd);
erase_trailing_newline(first_mac_addr); erase_trailing_newline(first_mac_addr);
result.node_id = cppa::util::ripemd_160(first_mac_addr + hd_serial); result.node_id = cppa::util::ripemd_160(first_mac_addr + hd_serial);
//memcpy(result.node_id, tmp.data(), cppa::process_information::node_id_size); //memcpy(result.node_id, tmp.data(), cppa::process_information::node_id_size);
......
...@@ -611,6 +611,17 @@ class uniform_type_info_map ...@@ -611,6 +611,17 @@ class uniform_type_info_map
insert<std::uint64_t>(ints[sizeof(std::uint64_t)].second); insert<std::uint64_t>(ints[sizeof(std::uint64_t)].second);
} }
~uniform_type_info_map()
{
m_by_rname.clear();
for (auto& kvp : m_by_uname)
{
delete kvp.second;
kvp.second = nullptr;
}
m_by_uname.clear();
}
uniform_type_info* by_raw_name(const std::string& name) uniform_type_info* by_raw_name(const std::string& name)
{ {
auto i = m_by_rname.find(name); auto i = m_by_rname.find(name);
......
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