diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-06-27 00:38:08 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-06-27 00:38:08 +0200 | 
| commit | 3f7625c02320c1e58da0f579750c76dc47603085 (patch) | |
| tree | ab15ee7d8a55402f0d6ff427a61b015cdfe67497 /client/server.gd | |
| parent | 140090a76e723fec6f3aea07cd7b7f463884be89 (diff) | |
| download | hurrycurry-3f7625c02320c1e58da0f579750c76dc47603085.tar hurrycurry-3f7625c02320c1e58da0f579750c76dc47603085.tar.bz2 hurrycurry-3f7625c02320c1e58da0f579750c76dc47603085.tar.zst | |
display failed server and convinience connect button
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: | 
