Fix setting external port and IP address for manual networking modes

This commit is contained in:
ksuprynowicz 2023-12-01 21:15:11 +01:00
parent d4a11ce0e6
commit f0a3a33905
2 changed files with 17 additions and 4 deletions

View file

@ -601,7 +601,7 @@ $(document).ready(function(){
form += '<label class="control-label">' + label + '</label>';
form += ' <a id="edit-network-address-port" class="domain-loading-hide" href="#">Edit</a>';
form += '<input type="text" class="domain-loading-hide form-control" disabled></input>';
form += '<div class="domain-loading-hide help-block">This defines how nodes will connect to your domain. You can read more about automatic networking <a href="">here</a>.</div>';
form += '<div class="domain-loading-hide help-block">This defines how nodes will connect to your domain. Since the displayed setting is read back from directory server, it takes some time to update after being edited. You can read more about automatic networking <a href="">here</a>.</div>';
form += '</div>';
form = $(form);
@ -664,7 +664,13 @@ $(document).ready(function(){
success: function(xhr) {
console.log(xhr, parseJSONResponse(xhr));
dialog.modal('hide');
reloadDomainInfo(); // TODO: this one doesn't work since directory server still has old data
setTimeout(function() {
reloadDomainInfo();
}, 16000);
setTimeout(function() {
reloadDomainInfo();
}, 64000);
},
error:function(xhr) {
var data = parseJSONResponse(xhr);

View file

@ -1570,12 +1570,19 @@ void DomainServer::performIPAddressPortUpdate(const SockAddr& newPublicSockAddr)
const QString& publicSocketAddress = newPublicSockAddr.getAddress().toString();
const int publicSocketPort = newPublicSockAddr.getPort();
if (_automaticNetworkingSetting == IP_ONLY_AUTOMATIC_NETWORKING_VALUE) {
sendHeartbeatToMetaverse(publicSocketAddress, 0);
} else {
// Full automatic networking, update both port and IP address
sendHeartbeatToMetaverse(publicSocketAddress, publicSocketPort);
}
QJsonObject rootObject;
QJsonObject domainServerObject;
domainServerObject.insert(PUBLIC_SOCKET_ADDRESS_KEY, publicSocketAddress);
if (_automaticNetworkingSetting == FULL_AUTOMATIC_NETWORKING_VALUE) {
domainServerObject.insert(PUBLIC_SOCKET_PORT_KEY, publicSocketPort);
}
rootObject.insert(DOMAIN_SERVER_SETTINGS_KEY, domainServerObject);
QJsonDocument doc(rootObject);
qDebug() << "DomainServer::performIPAddressPortUpdate: " << doc;