mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
fix(handoff): job-control jobs stay counted; unnamed requests refused; cancel-safe setup
This commit is contained in:
1 parent
80ec4d7517
commit
d7f0ce82d8
4 files changed
+59
-112
No files matched your search
@@ -335,7 +335,8 @@ object GuestWorkers {
|
||||
confirmed: () -> Boolean = { true }, owner: Int = session): Int {
|
||||
val app = context.applicationContext
|
||||
if (guest && owner <= stopped) {
|
||||
Log.w(TAG, "session $owner is stopping: not starting ${argv.firstOrNull()}")
|
||||
Log.w(TAG, (if (owner == 0) "a request naming no session" else "session $owner is stopping") +
|
||||
": not starting ${argv.firstOrNull()}")
|
||||
return -1
|
||||
}
|
||||
val slot = takeWarm() ?: bind(app)?.takeIf { fresh ->
|
||||
@@ -738,8 +739,9 @@ object GuestWorkers {
|
||||
var confirmedToHook = false
|
||||
// The session whose guest asks, not the latest: a new session can start (serve()) while an
|
||||
// older one's guests are still sending, and that older one's teardown must find its programs.
|
||||
// A request that names none (a guest of an older build) is the latest's.
|
||||
val owner = request.optInt("session", 0).takeIf { it > 0 } ?: session
|
||||
// A request that names none is refused (start() runs nothing for session 0): the hook and
|
||||
// droiddeck-spawn always name it, and which session's it is cannot be told otherwise.
|
||||
val owner = request.optInt("session", 0).coerceAtLeast(0)
|
||||
val pid = start(app, command, env.map { (k, v) -> "$k=$v" }, programFds, targets, true, owner = owner, onExit = { code ->
|
||||
status = code
|
||||
if (table != null && slot >= 0) reportExit(table, slot, code, parent, child, worker)
|
||||
|
||||
Reference in new issue
Block a user