Compare commits
2 Commits
f431336f8d
...
c1b696d8cc
Author | SHA1 | Date |
---|---|---|
Martyn | c1b696d8cc | |
Martyn | 5725eaf8a7 |
|
@ -208,7 +208,7 @@ func QuitHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
fmt.Fprint(w, "BYE!\n")
|
fmt.Fprint(w, "BYE!\n")
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,19 @@ func _ready():
|
||||||
|
|
||||||
func _notification(what):
|
func _notification(what):
|
||||||
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
|
||||||
print("Killing dl-server, pid ",pid_of_dlserver)
|
var h = HTTPClient.new()
|
||||||
OS.kill(pid_of_dlserver)
|
var err = h.connect_to_host("127.0.0.1", 10435) # Connect to host/port.
|
||||||
|
assert(err == OK)
|
||||||
|
while h.get_status() == HTTPClient.STATUS_CONNECTING or h.get_status() == HTTPClient.STATUS_RESOLVING:
|
||||||
|
h.poll()
|
||||||
|
print("Connecting...")
|
||||||
|
OS.delay_msec(500)
|
||||||
|
assert(h.get_status() == HTTPClient.STATUS_CONNECTED) # Could not connect
|
||||||
|
var headers = [
|
||||||
|
"User-Agent: Pirulo/1.0 (Godot)",
|
||||||
|
"Accept: */*"
|
||||||
|
]
|
||||||
|
h.request(HTTPClient.METHOD_GET, "/quit/", headers)
|
||||||
get_tree().quit() # default behavior
|
get_tree().quit() # default behavior
|
||||||
|
|
||||||
func loadConfig():
|
func loadConfig():
|
||||||
|
|
|
@ -37,7 +37,7 @@ func _on_Timer2_timeout():
|
||||||
|
|
||||||
|
|
||||||
func _on_ValidateServerRunningTimer_timeout():
|
func _on_ValidateServerRunningTimer_timeout():
|
||||||
$HTTPRequest.request("http://127.0.0.1:10435/")
|
$HTTPRequest.request("http://127.0.0.1:10435/pid/")
|
||||||
|
|
||||||
|
|
||||||
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
||||||
|
|
Loading…
Reference in New Issue