|
@@ -305,6 +305,12 @@ def init(address_param="127.0.0.1:8001", timeout=20.0):
|
|
|
import http_client
|
|
|
global ctrl_input
|
|
|
global ctrl_output
|
|
|
+
|
|
|
+ if ctrl_input is not None:
|
|
|
+ ctrl_input.stop()
|
|
|
+ if ctrl_output is not None:
|
|
|
+ ctrl_output.stop()
|
|
|
+
|
|
|
ctrl_input = http_client.Controller()
|
|
|
ctrl_output = http_client.Controller()
|
|
|
controllers = [ctrl_input, ctrl_output]
|
|
@@ -318,7 +324,6 @@ def init(address_param="127.0.0.1:8001", timeout=20.0):
|
|
|
thrd = threading.Thread(target=ctrl.start)
|
|
|
thrd.daemon = True
|
|
|
thrd.start()
|
|
|
- time.sleep(0.1)
|
|
|
|
|
|
evt = listener.fetch(-1)
|
|
|
if evt.name != "http_client_initialized":
|
|
@@ -327,6 +332,9 @@ def init(address_param="127.0.0.1:8001", timeout=20.0):
|
|
|
ctrl.addInput(Event("connect", "request_in", [(addr, port), timeout]))
|
|
|
|
|
|
evt = listener.fetch(-1)
|
|
|
+
|
|
|
+ if evt.name == "http_client_timeout":
|
|
|
+ raise Exception("HTTP client timeout")
|
|
|
if evt.name != "http_client_ready":
|
|
|
raise Exception("HTTP client did not behave as expected during connect: " + str(evt.name))
|
|
|
|
|
@@ -354,9 +362,7 @@ def login(username, password):
|
|
|
global mode
|
|
|
_goto_mode(MODE_UNAUTHORIZED)
|
|
|
|
|
|
- print("Wait for output")
|
|
|
_output("Log on as which user?")
|
|
|
- print("Got that output")
|
|
|
_input(username)
|
|
|
if _output() == "Password for existing user?":
|
|
|
_input(password)
|