mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-01-26 02:11:10 +00:00
improve socket address resolution handling
This commit is contained in:
parent
29ac15846d
commit
617ad380c0
2 changed files with 4 additions and 2 deletions
|
@ -32,7 +32,7 @@ public class ProxyTcpOverTlsTransport extends TcpOverTlsTransport {
|
|||
protected void createSocket() throws IOException {
|
||||
InetSocketAddress proxyAddr = new InetSocketAddress(proxy.getHost(), proxy.getPortOrDefault(DEFAULT_PROXY_PORT));
|
||||
socket = new Socket(new Proxy(Proxy.Type.SOCKS, proxyAddr));
|
||||
socket.connect(new InetSocketAddress(server.getHost(), server.getPortOrDefault(getDefaultPort())));
|
||||
socket.connect(InetSocketAddress.createUnresolved(server.getHost(), server.getPortOrDefault(getDefaultPort())));
|
||||
socket = sslSocketFactory.createSocket(socket, proxy.getHost(), proxy.getPortOrDefault(DEFAULT_PROXY_PORT), true);
|
||||
startHandshake((SSLSocket)socket);
|
||||
}
|
||||
|
|
|
@ -268,7 +268,9 @@ public class TcpTransport implements CloseableTransport, TimeoutCounter {
|
|||
|
||||
protected void createSocket() throws IOException {
|
||||
socket = socketFactory.createSocket();
|
||||
socket.connect(new InetSocketAddress(server.getHost(), server.getPortOrDefault(getDefaultPort())));
|
||||
socket.connect(socketFactory instanceof ProxySocketFactory ?
|
||||
InetSocketAddress.createUnresolved(server.getHost(), server.getPortOrDefault(getDefaultPort())) :
|
||||
new InetSocketAddress(server.getHost(), server.getPortOrDefault(getDefaultPort())));
|
||||
}
|
||||
|
||||
protected int getDefaultPort() {
|
||||
|
|
Loading…
Reference in a new issue