diff options
Diffstat (limited to 'client/server.gd')
-rw-r--r-- | client/server.gd | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/client/server.gd b/client/server.gd index c935b645..11e8024c 100644 --- a/client/server.gd +++ b/client/server.gd @@ -8,6 +8,7 @@ var state = State.TESTING enum State { TESTING, UNAVAILABLE, + FAILED, STOPPED, STARTING, RUNNING, @@ -23,7 +24,7 @@ func _ready(): func start(): - if state != State.STOPPED: + if state != State.STOPPED and state != State.FAILED: push_error("server cant be started") return state = State.STARTING @@ -53,6 +54,9 @@ func _server_exec(): elif conn.get_status() == StreamPeerTCP.STATUS_CONNECTED: ok = true; break OS.delay_msec(10) OS.delay_msec(500 if not ok else 50) + if !OS.is_process_running(thread_result): + thread_result = -1 + break sem.post() func _process(_delta): @@ -70,7 +74,9 @@ func _process(_delta): state = State.RUNNING pid = thread_result print("Server: Started pid=", thread_result) - else: state = State.STOPPED + else: + state = State.FAILED + print("Server: Failed") thread.wait_to_finish() thread = null State.RUNNING: |