mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
[core] Use UInt16 for ConnectionConfiguration 'port'
This commit is contained in:
parent
9a8ee3c8e3
commit
cac874bdc7
3 changed files with 17 additions and 10 deletions
|
@ -42,7 +42,7 @@ public final class IpTcpRemoteConnectionEndpoint<IARR extends InternetAddressRR>
|
|||
this.internetAddressResourceRecord = internetAddressResourceRecord;
|
||||
}
|
||||
|
||||
public static IpTcpRemoteConnectionEndpoint<InternetAddressRR> from(CharSequence host, int port,
|
||||
public static IpTcpRemoteConnectionEndpoint<InternetAddressRR> from(CharSequence host, UInt16 port,
|
||||
InetAddress inetAddress) {
|
||||
InternetAddressRR internetAddressResourceRecord;
|
||||
// TODO: Use InternetAddressRR.from(InetAddress) once MiniDNS is updated.
|
||||
|
@ -52,7 +52,7 @@ public final class IpTcpRemoteConnectionEndpoint<IARR extends InternetAddressRR>
|
|||
internetAddressResourceRecord = new AAAA((Inet6Address) inetAddress);
|
||||
}
|
||||
|
||||
return new IpTcpRemoteConnectionEndpoint<InternetAddressRR>(host, UInt16.from(port),
|
||||
return new IpTcpRemoteConnectionEndpoint<InternetAddressRR>(host, port,
|
||||
internetAddressResourceRecord);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.logging.Logger;
|
|||
|
||||
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||
import org.jivesoftware.smack.ConnectionConfiguration.DnssecMode;
|
||||
import org.jivesoftware.smack.datatypes.UInt16;
|
||||
import org.jivesoftware.smack.util.DNSUtil;
|
||||
import org.jivesoftware.smack.util.dns.DNSResolver;
|
||||
import org.jivesoftware.smack.util.rce.RemoteConnectionEndpoint;
|
||||
|
@ -72,7 +73,7 @@ public class RemoteXmppTcpConnectionEndpoints {
|
|||
|
||||
if (hostAddresses != null) {
|
||||
discoveredRemoteConnectionEndpoints = new ArrayList<>(hostAddresses.size());
|
||||
int port = config.getPort();
|
||||
UInt16 port = config.getPort();
|
||||
for (InetAddress inetAddress : hostAddresses) {
|
||||
IpTcpRemoteConnectionEndpoint<InternetAddressRR> connectionEndpoint = IpTcpRemoteConnectionEndpoint.from(
|
||||
host, port, inetAddress);
|
||||
|
@ -198,13 +199,13 @@ public class RemoteXmppTcpConnectionEndpoints {
|
|||
LOGGER.info("Could not resolve DNS SRV resource records for " + srvDomain + ". Consider adding those.");
|
||||
}
|
||||
|
||||
int defaultPort;
|
||||
UInt16 defaultPort;
|
||||
switch (domainType) {
|
||||
case client:
|
||||
defaultPort = 5222;
|
||||
defaultPort = UInt16.from(5222);
|
||||
break;
|
||||
case server:
|
||||
defaultPort = 5269;
|
||||
defaultPort = UInt16.from(5269);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue