Skip to content
Snippets Groups Projects
Commit 525edab7 authored by sphere's avatar sphere
Browse files

Merge branch 'avoid-update-failed-ms' into 'next'

Avoid updating IPv4 MS entry if it failed to register

See merge request !2462
parents 0f479f60 19500742
No related branches found
No related tags found
1 merge request!2462Avoid updating IPv4 MS entry if it failed to register
Pipeline #4318 passed
...@@ -486,8 +486,10 @@ int ...@@ -486,8 +486,10 @@ int
HMS_unlist (void) HMS_unlist (void)
{ {
struct HMS_buffer *hms; struct HMS_buffer *hms;
int ok; int ok = 0;
if (hms_server_token)
{
hms = HMS_connect(PROTO_V4, "servers/%s/unlist", hms_server_token); hms = HMS_connect(PROTO_V4, "servers/%s/unlist", hms_server_token);
if (! hms) if (! hms)
...@@ -500,6 +502,7 @@ HMS_unlist (void) ...@@ -500,6 +502,7 @@ HMS_unlist (void)
HMS_end(hms); HMS_end(hms);
free(hms_server_token); free(hms_server_token);
}
#ifndef NO_IPV6 #ifndef NO_IPV6
if (hms_server_token_ipv6 && hms_allow_ipv6) if (hms_server_token_ipv6 && hms_allow_ipv6)
...@@ -526,18 +529,13 @@ int ...@@ -526,18 +529,13 @@ int
HMS_update (void) HMS_update (void)
{ {
struct HMS_buffer *hms; struct HMS_buffer *hms;
int ok; int ok = 0;
char post[256]; char post[256];
char *title; char *title;
hms = HMS_connect(PROTO_V4, "servers/%s/update", hms_server_token); title = curl_easy_escape(NULL, cv_servername.string, 0);
if (! hms)
return 0;
title = curl_easy_escape(hms->curl, cv_servername.string, 0);
snprintf(post, sizeof post, snprintf(post, sizeof post,
"title=%s", "title=%s",
...@@ -546,10 +544,18 @@ HMS_update (void) ...@@ -546,10 +544,18 @@ HMS_update (void)
curl_free(title); curl_free(title);
if (hms_server_token)
{
hms = HMS_connect(PROTO_V4, "servers/%s/update", hms_server_token);
if (! hms)
return 0;
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post); curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
ok = HMS_do(hms); ok = HMS_do(hms);
HMS_end(hms); HMS_end(hms);
}
#ifndef NO_IPV6 #ifndef NO_IPV6
if (hms_server_token_ipv6 && hms_allow_ipv6) if (hms_server_token_ipv6 && hms_allow_ipv6)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment