Modern Apps git

← Modern-Apps.git

auto: run the delegated TLS task that was actually fetched

Commit
8ee0d0b473f68cbcaee67111f3d03b18fb80e1a9
Author
Vayun Mathur <[email protected]>
When
2026-11-06 05:30 UTC (1 month ago)
Parents
5bb771d
827ba5556 split NEED_TASK into a null check plus a second engine.delegatedTask call.
SSLEngine hands each task out once, so the checked task was dropped and the handshake
stalled in HANDSHAKING. Caught by GalControlSessionTest.

Diff

auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalControlSession.kt
diff --git a/auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalControlSession.kt b/auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalControlSession.ktindex 634068de3e..bd176f5ba0 100644--- a/auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalControlSession.kt+++ b/auto/protocol/src/main/java/com/vayunmathur/auto/protocol/GalControlSession.kt@@ -587,11 +587,13 @@ private class HandshakePump(     ): Boolean? {         when (engine.handshakeStatus) {             HandshakeStatus.NEED_TASK -> {-                // No task to run: wait for more inbound like the original-                // `delegatedTask?.run() ?: return outgoing`. A ran task may-                // have advanced the engine, so keep pumping.-                engine.delegatedTask ?: return null-                engine.delegatedTask?.run()+                // A single getter call: run the task the engine handed us, if+                // any. A ran task may have advanced the engine, so keep+                // pumping. Fetching twice (check-then-run) drops handshake+                // work when the getter hands out a fresh task per call and+                // wedges the engine at NEED_TASK with no error.+                val task = engine.delegatedTask ?: return null+                task.run()                 return true             }             HandshakeStatus.NEED_UNWRAP -> return pumpUnwrap()