diff options
Diffstat (limited to 'client/server_list.gd')
-rw-r--r-- | client/server_list.gd | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/client/server_list.gd b/client/server_list.gd index f3c1b456..32feb242 100644 --- a/client/server_list.gd +++ b/client/server_list.gd @@ -38,6 +38,10 @@ var reg := HTTPRequest.new() var thread: Thread var pid: int = -1 +# Fallback to http, since there seems to be a problem related to mbed tls in Godot. +# See: https://github.com/godotengine/godot/issues/96103 +var using_http_fallback := false + var mdns_timer := Timer.new() var reg_timer := Timer.new() # after 30 minutes we stop fetching results to reduce server load @@ -85,7 +89,9 @@ func fetch_server_list(registry: Registry) -> void: Registry.MDNS: mdns.request(MDNS_URL, HEADERS) Registry.GLOBAL: - reg.request(Global.get_setting("online.registry_url") + "/v1/list", HEADERS) + var url: String = Global.get_setting("online.registry_url") + url = url.replace("https:", "http:") if using_http_fallback else url + reg.request(url + "/v1/list", HEADERS) loading = true update_loading.emit(true) @@ -94,7 +100,11 @@ func _on_request_completed(result: int, _response_code: int, _headers: PackedStr loading = false update_loading.emit(false) if result != 0: - push_warning("Fetching server list failed with code %d" % result) + push_warning("Fetching server list failed with code %d." % result) + if !using_http_fallback: + print("Retrying with http...") + using_http_fallback = true + fetch_server_list(Registry.GLOBAL) return var json = JSON.parse_string(body.get_string_from_utf8()) if json == null: |