Browse Source

Fix update failing when IPv6 available

Use a new subdomain ipv4.cosinegaming.com, which contains the same IP
but only IPv4, so that godot will not try to use IPv6, which it cannot
do (it fails Error #2).

See https://github.com/godotengine/godot/issues/18275 for details on
that godot bug.
master
Luna 7 years ago
parent
commit
f2b354caa9
2 changed files with 7 additions and 3 deletions
  1. +1
    -0
      scenes/update.tscn
  2. +6
    -3
      scripts/update.gd

+ 1
- 0
scenes/update.tscn View File

@ -30,6 +30,7 @@ use_threads = false
body_size_limit = -1
max_redirects = 8
script = ExtResource( 1 )
domain = "http://ipv4.cosinegaming.com"
[node name="ProgressBar" type="ProgressBar" parent="." index="1"]


+ 6
- 3
scripts/update.gd View File

@ -3,11 +3,12 @@ extends HTTPRequest
var is_update_payload = false
var save_to
var time = 0
export var domain = "http://ipv4.cosinegaming.com"
func _ready():
connect("request_completed", self, "_request_completed")
# Check if we need an update
request("https://www.cosinegaming.com/static/vanagloria/version.json", [], false)
request(domain + "/static/vanagloria/version.json", [], false)
set_process(true)
func _request_completed(result, response_code, headers, body):
@ -27,7 +28,7 @@ func _request_completed(result, response_code, headers, body):
save_to = server.save_location
use_threads = true
print("Need to update! Downloading " + server.download_path)
request(server.download_path)
request(domain + server.download_path)
else:
print("Update recieved. Saving to " + save_to)
var file = File.new()
@ -39,7 +40,9 @@ func _request_completed(result, response_code, headers, body):
func _process(delta):
time += delta
var fake_progress = 1 - (0.8 / time)
get_node("../ProgressBar").value = 100*fake_progress
# var progress = get_downloaded_bytes() / get_body_size()
var progress = fake_progress
get_node("../ProgressBar").value = 100*progress
func restart():
# Pass on args to new instance, then quit


Loading…
Cancel
Save