Skip to content

Commit

Permalink
Merge pull request #192 from 3Hren/v0.12
Browse files Browse the repository at this point in the history
[Bug Fix] Fixed app/service list consistency.
  • Loading branch information
Andrey Sibiryov committed Apr 17, 2015
2 parents d02b0a1 + 1503c13 commit b34bc3a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
5 changes: 4 additions & 1 deletion cocaine-bf.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Summary: Cocaine - Core Libraries
Name: libcocaine-core3
Version: 0.12.0.7
Version: 0.12.0.8
Release: 1%{?dist}


Expand Down Expand Up @@ -125,6 +125,9 @@ rm -rf %{buildroot}
%{_sysconfdir}/cocaine/cocaine-default.conf

%changelog
* Fri Apr 17 2015 Evgeny Safronov <division494@gmail.com> 0.12.0.8-1
- Bugfix: fixed app vs. published services list inconsistency.

* Wed Apr 08 2015 Andrey Sibiryov <me@kobology.ru> 0.12.0.7-1
- Remote connections are now retried on failure.
- Bugfix: endpoints while connecting remotes were corrupted in logs.
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
cocaine-core (0.12.0.8) unstable; urgency=low

* Bugfix: fixed app vs. published services list inconsistency.

-- Evgeny Safronov <division494@gmail.com> Fri, 17 Apr 2015 19:56:54 +0300

cocaine-core (0.12.0.7) unstable; urgency=low

* Remote connections are now retried on failure.
Expand Down
20 changes: 9 additions & 11 deletions src/service/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,19 @@ node_t::prototype() const {

void
node_t::on_start_app(const std::string& name, const std::string& profile) {
auto ptr = m_apps.synchronize();
auto it = ptr->find(name);
m_apps.apply([&](std::map<std::string, std::shared_ptr<app_t>>& apps) {
COCAINE_LOG_DEBUG(m_log, "starting app '%s'", name);

COCAINE_LOG_INFO(m_log, "trying to start app '%s'", name);
auto it = apps.find(name);
if(it != apps.end()) {
throw cocaine::error_t("app '%s' is already running", name);
}

if(it != ptr->end()) {
throw cocaine::error_t("app '%s' is already running", name);
}
auto app = std::make_shared<app_t>(m_context, name, profile);
app->start();

std::tie(it, std::ignore) = ptr->insert({
name,
std::make_shared<app_t>(m_context, name, profile)
apps.insert(std::make_pair(name, app));
});

it->second->start();
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/service/node/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ app_t::~app_t() {

void
app_t::start() {
COCAINE_LOG_INFO(m_log, "creating engine '%s'", m_manifest->name);
COCAINE_LOG_DEBUG(m_log, "creating engine '%s'", m_manifest->name);

// Start the engine thread.
try {
Expand Down
4 changes: 2 additions & 2 deletions src/service/node/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ engine_t::engine_t(context_t& context, const manifest_t& manifest, const profile
}

engine_t::~engine_t() {
COCAINE_LOG_DEBUG(m_log, "stopping '%s' engine", m_manifest.name);

boost::filesystem::remove(m_manifest.endpoint);

m_loop.post(std::bind(&engine_t::migrate, this, states::stopping));

if(m_thread.joinable()) {
m_thread.join();
}

COCAINE_LOG_DEBUG(m_log, "app '%s' engine has been destroyed", m_manifest.name);
}

void
Expand Down

0 comments on commit b34bc3a

Please sign in to comment.