mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
fix master server communication
This commit is contained in:
@@ -615,7 +615,7 @@ void Network::UpdateServer()
|
||||
|
||||
switch (advertise_status) {
|
||||
case ADVERTISE_STATUS_UNREGISTERED:
|
||||
if (SDL_TICKS_PASSED(SDL_GetTicks(), last_advertise_time + MASTER_SERVER_REGISTER_TIME)) {
|
||||
if (last_advertise_time == 0 || SDL_TICKS_PASSED(SDL_GetTicks(), last_advertise_time + MASTER_SERVER_REGISTER_TIME)) {
|
||||
AdvertiseRegister();
|
||||
}
|
||||
break;
|
||||
@@ -856,7 +856,7 @@ void Network::AdvertiseRegister()
|
||||
// Send the registration request
|
||||
std::string url = GetMasterServerUrl()
|
||||
+ std::string("?command=register&port=") + std::to_string(listening_port)
|
||||
+ std::string("key=") + advertise_key;
|
||||
+ std::string("&key=") + advertise_key;
|
||||
http_request_json_async(url.c_str(), [](http_json_response *response) -> void {
|
||||
if (response == NULL) {
|
||||
log_warning("Unable to connect to master server");
|
||||
@@ -892,8 +892,7 @@ void Network::AdvertiseHeartbeat()
|
||||
// Send the heartbeat request
|
||||
std::string url = GetMasterServerUrl()
|
||||
+ std::string("?command=heartbeat&token=") + advertise_token
|
||||
+ std::string("key=") + advertise_key
|
||||
+ std::string("players=") + std::to_string(network_get_num_players());
|
||||
+ std::string("&players=") + std::to_string(network_get_num_players());
|
||||
|
||||
// TODO send status data (e.g. players) via JSON body
|
||||
|
||||
|
||||
Reference in New Issue
Block a user