Fix Liam waiting rotation and capability ready acknowledgement
This commit is contained in:
@@ -43,11 +43,17 @@ fun main() {
|
||||
check(client.actionNegotiation=="pending_pack")
|
||||
readyPin=pin;check(client.capabilitiesReady())
|
||||
check(socket.sent.last()==DialogueProtocol.capabilitiesReady(pin))
|
||||
receive("""{"type":"client.capabilities","action_available":true,"action_pack_sha256":"${"f".repeat(64)}"}""")
|
||||
check(client.actionNegotiation=="pending_pack")
|
||||
receive("""{"type":"client.capabilities","action_available":true,"action_pack_sha256":"$pin","turn_id":0,"seq":1,"server_ms":1}""")
|
||||
check(client.actionNegotiation=="accepted")
|
||||
} else check(client.actionNegotiation=="accepted")
|
||||
client.disconnect()
|
||||
old.onMessage(socket,"""{"type":"auth","state":"ok"}""")
|
||||
old.onMessage(socket,"""{"type":"hello","action_available":true}""");Handler.drain()
|
||||
old.onMessage(socket,"""{"type":"client.capabilities","action_available":true,"action_pack_sha256":"$pin"}""");Handler.drain()
|
||||
check(socket.cancelled && statuses.last()==ConnectionStatus.DISCONNECTED)
|
||||
check(client.actionNegotiation=="disconnected")
|
||||
val count=socket.sent.size
|
||||
old.onMessage(Socket(),"""{"type":"auth","state":"ok"}""");Handler.drain()
|
||||
check(socket.sent.size==count)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package org.json
|
||||
|
||||
// Bounded flat AUTH/HELLO response adapter. Outbound JSON uses production protocol.
|
||||
// Bounded flat AUTH/HELLO/capability response adapter. Outbound JSON uses production protocol.
|
||||
// This does not exercise Android's JSON parser, which the APK build compiles.
|
||||
class JSONObject() {
|
||||
private val fields=linkedMapOf<String,Any>()
|
||||
constructor(text: String):this() {
|
||||
check(text.length<2048 && text.startsWith("{") && text.endsWith("}"))
|
||||
val entries=Regex("\"([a-z_]+)\":(\"[a-z_]+\"|true|false|[0-9]+)").findAll(text)
|
||||
val entries=Regex("\"([a-z0-9_]+)\"\\s*:\\s*(\"[a-z0-9_.-]*\"|true|false|[0-9]+)").findAll(text)
|
||||
entries.forEach {
|
||||
val raw=it.groupValues[2]
|
||||
fields[it.groupValues[1]]=when {
|
||||
|
||||
Reference in New Issue
Block a user