From 93bb55e413778a7f44b497f84fd0ce09e23f709e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 11 Nov 2015 21:25:36 +0100 Subject: [PATCH] launch_daemon: Fixed resetting launch status, port update. * _SetLaunchStatus() doesn't allow to set the status to B_NO_INIT (and rightly so). * Therefore, we now reset it manually in Job::TeamDeleted(). This fixes restarting things that once ran on demand. * Also update the port message when the default port changes. --- src/servers/launch/Job.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/servers/launch/Job.cpp b/src/servers/launch/Job.cpp index 9d3c50cead3..b999c0530c0 100644 --- a/src/servers/launch/Job.cpp +++ b/src/servers/launch/Job.cpp @@ -313,6 +313,16 @@ void Job::SetDefaultPort(port_id port) { fDefaultPort = port; + + PortMap::iterator iterator = fPortMap.begin(); + for (; iterator != fPortMap.end(); iterator++) { + BString name; + if (iterator->second.HasString("name")) + continue; + + iterator->second.SetInt32("port", (int32)port); + break; + } } @@ -396,7 +406,8 @@ Job::TeamDeleted() if (IsService()) SetState(B_JOB_STATE_WAITING_TO_RUN); - _SetLaunchStatus(B_NO_INIT); + MutexLocker locker(fLaunchStatusLock); + fLaunchStatus = B_NO_INIT; }