mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
DnsLookupTor: Close socket after usage
This commit is contained in:
parent
e1c7a0dc30
commit
f92f4e8da0
@ -60,16 +60,14 @@ public class DnsLookupTor {
|
|||||||
* Performs DNS lookup and returns a single InetAddress
|
* Performs DNS lookup and returns a single InetAddress
|
||||||
*/
|
*/
|
||||||
public static InetAddress lookup(Socks5Proxy proxy, String host) throws DnsLookupException {
|
public static InetAddress lookup(Socks5Proxy proxy, String host) throws DnsLookupException {
|
||||||
try {
|
// note: This is creating a new connection to our proxy, without any authentication.
|
||||||
// note: This is creating a new connection to our proxy, without any authentication.
|
// This works fine when connecting to bisq's internal Tor proxy, but
|
||||||
// This works fine when connecting to bisq's internal Tor proxy, but
|
// would fail if user has configured an external proxy that requires auth.
|
||||||
// would fail if user has configured an external proxy that requires auth.
|
// It would be much better to use the already connected proxy socket, but when I
|
||||||
// It would be much better to use the already connected proxy socket, but when I
|
// tried that I get weird errors and the lookup fails.
|
||||||
// tried that I get weird errors and the lookup fails.
|
//
|
||||||
//
|
// So this is an area for future improvement.
|
||||||
// So this is an area for future improvement.
|
try (Socket proxySocket = new Socket(proxy.getInetAddress(), proxy.getPort())) {
|
||||||
Socket proxySocket = new Socket(proxy.getInetAddress(), proxy.getPort());
|
|
||||||
|
|
||||||
proxySocket.getOutputStream().write(new byte[]{b('\u0005'), b('\u0001'), b('\u0000')});
|
proxySocket.getOutputStream().write(new byte[]{b('\u0005'), b('\u0001'), b('\u0000')});
|
||||||
byte[] buf = new byte[2];
|
byte[] buf = new byte[2];
|
||||||
//noinspection ResultOfMethodCallIgnored
|
//noinspection ResultOfMethodCallIgnored
|
||||||
|
Loading…
Reference in New Issue
Block a user