forked from Qortal/qortal
Include the external port when responding ArbitraryDataFileListRequests
This commit is contained in:
parent
6697b3376b
commit
f0136a5018
@ -627,7 +627,7 @@ public class ArbitraryDataFileListManager {
|
|||||||
arbitraryDataFileListRequests.put(message.getId(), newEntry);
|
arbitraryDataFileListRequests.put(message.getId(), newEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
String ourAddress = Network.getInstance().getOurExternalIpAddress();
|
String ourAddress = Network.getInstance().getOurExternalIpAddressAndPort();
|
||||||
ArbitraryDataFileListMessage arbitraryDataFileListMessage = new ArbitraryDataFileListMessage(signature,
|
ArbitraryDataFileListMessage arbitraryDataFileListMessage = new ArbitraryDataFileListMessage(signature,
|
||||||
hashes, NTP.getTime(), 0, ourAddress, true);
|
hashes, NTP.getTime(), 0, ourAddress, true);
|
||||||
arbitraryDataFileListMessage.setId(message.getId());
|
arbitraryDataFileListMessage.setId(message.getId());
|
||||||
|
@ -121,6 +121,7 @@ public class Network {
|
|||||||
|
|
||||||
private List<String> ourExternalIpAddressHistory = new ArrayList<>();
|
private List<String> ourExternalIpAddressHistory = new ArrayList<>();
|
||||||
private String ourExternalIpAddress = null;
|
private String ourExternalIpAddress = null;
|
||||||
|
private int ourExternalPort = Settings.getInstance().getListenPort();
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
@ -1160,6 +1161,7 @@ public class Network {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String host = parts[0];
|
String host = parts[0];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InetAddress addr = InetAddress.getByName(host);
|
InetAddress addr = InetAddress.getByName(host);
|
||||||
if (addr.isAnyLocalAddress() || addr.isSiteLocalAddress()) {
|
if (addr.isAnyLocalAddress() || addr.isSiteLocalAddress()) {
|
||||||
@ -1170,6 +1172,9 @@ public class Network {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep track of the port
|
||||||
|
this.ourExternalPort = Integer.parseInt(parts[1]);
|
||||||
|
|
||||||
// Add to the list
|
// Add to the list
|
||||||
this.ourExternalIpAddressHistory.add(host);
|
this.ourExternalIpAddressHistory.add(host);
|
||||||
|
|
||||||
@ -1232,6 +1237,14 @@ public class Network {
|
|||||||
return this.ourExternalIpAddress;
|
return this.ourExternalIpAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOurExternalIpAddressAndPort() {
|
||||||
|
String ipAddress = this.getOurExternalIpAddress();
|
||||||
|
if (ipAddress == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return String.format("%s:%d", ipAddress, this.ourExternalPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Peer-management calls
|
// Peer-management calls
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user