Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Fix] Fixed app/service list consistency. #192

Merged
merged 4 commits into from
Apr 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]> 0.12.0.8-1
- Bugfix: fixed app vs. published services list inconsistency.

* Wed Apr 08 2015 Andrey Sibiryov <[email protected]> 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 <[email protected]> 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