diff --git a/uni/udb/adapter.icn b/uni/udb/adapter.icn index d85b1a46c..1f1b671d0 100644 --- a/uni/udb/adapter.icn +++ b/uni/udb/adapter.icn @@ -54,7 +54,9 @@ class Adapter( return cmd } every request_body := get_request(sock) do { - #write("command: "||jtou(request_body)["command"]||"\n") +$ifdef VERBOSE + write("client -> udb:\n" || request_body) +$endif if \waitingForTerminal then { if jtou(request_body)["command"] ~== "runInTerminal" then { #write("put "||jtou(request_body)["command"]) @@ -212,12 +214,12 @@ class Adapter( responseHeader := "Content-Length:" || *responseBody || "\r\n\r\n" - #write(ximage(responseTable)) - - #write("udap -> client: " || responseBody) - seq +:= 1 +$ifdef VERBOSE + write("udb -> client:\n" || responseBody) +$endif + return responseHeader || responseBody end @@ -235,10 +237,12 @@ class Adapter( requestBody := tojson(requestTable) requestHeader := "Content-Length:" || *requestBody || "\r\n\r\n" - #write("udap -> client: " || requestBody) - seq +:= 1 +$ifdef VERBOSE + write("udb -> client:\n" || requestBody) +$endif + return requestHeader || requestBody end @@ -260,10 +264,12 @@ class Adapter( ]) eventHeader := "Content-Length:" || *eventBody || "\r\n\r\n" - #write("udap -> client: " || eventBody) - seq +:= 1 +$ifdef VERBOSE + write("udb -> client:\n" || eventBody) +$endif + return eventHeader || eventBody end @@ -914,14 +920,15 @@ class Adapter( writes(sock, event) end - # Disconnect from client and udb and startup as a fresh session. + # Disconnect from client and udb and end session. method disconnect() + close(\dapcomSock) # Kill terminal running dapcom kill(\shellProcessId, 9) # End communication with client close(\sock) - # Restart session - put_cmdQueue("reset") + # End session + exit() end # Open a port as a server and block until client connect. @@ -934,8 +941,12 @@ class Adapter( every !5 do if sock := open(port, "na") then return sock - else + else { +$ifdef VERBOSE + write("open(",port,") ERROR: ", \&errortext | "Unknown") +$endif delay(1000) + } #write("udap failed to open port: " || port) end diff --git a/uni/udb/console.icn b/uni/udb/console.icn index 5dcbed393..0d189f092 100644 --- a/uni/udb/console.icn +++ b/uni/udb/console.icn @@ -106,7 +106,9 @@ method get_Line() ] } - writes(PROMPT) + if \mode ~== "--adapter" then { + writes(PROMPT) + } # if line mode, read a whole line the old fashioned way, skip this function if \mode == "--line" | \mode == "--adapter" then diff --git a/uni/udb/state.icn b/uni/udb/state.icn index 848b91de2..0984968de 100644 --- a/uni/udb/state.icn +++ b/uni/udb/state.icn @@ -60,13 +60,10 @@ method Write(Msg) if member(Msg, "consoleMsg") then Msg["consoleMsg"] := replacem(\Msg["consoleMsg"], "\"", "\\\"") Msg["state"] := State - # write(sock, utoj(Msg)) udap.processResult(Msg) } else { output := ["consoleMsg": replacem(Msg, "\"", "\\\""); "state": State] - # write(sock, utoj(output)) - write("\nprocess result called\n") udap.processResult(output) } } @@ -84,7 +81,6 @@ end method stateRead() local msg := "" if \mode == "--adapter" then { - write("udb reading...") return udap.getNextCommand() } else { @@ -106,12 +102,10 @@ method Writes(Msg) if member(Msg, "consoleMsg") then Msg["consoleMsg"] := replacem(\Msg["consoleMsg"], "\"", "\\\"") Msg["state"] := State - #writes(sock, utoj(Msg)) udap.processResult(Msg) } else { output := ["consoleMsg": replacem(Msg, "\"", "\\\""); "state": State] - #writes(sock, utoj(output)) udap.processResult(output) } }