mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 00:59:39 +02:00
Use XMPP connection as local SOCKS5 address
The default local address is often just "the first address found in the list of addresses read from the OS" and this might mean an internal IP address that cannot reach external servers. So wherever possible use the same IP address being used to connect to the XMPP server because this local address has a better chance of being suitable. This MR adds the above behaviour, and two UTs to test that we use the local XMPP connection IP when connected, and the previous behaviour when not.
This commit is contained in:
parent
f6c85d9fb3
commit
ffd027cc7d
7 changed files with 124 additions and 1 deletions
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
|||
import java.io.PipedReader;
|
||||
import java.io.PipedWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
@ -314,6 +315,11 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetAddress getLocalAddress() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutdown() {
|
||||
instantShutdown();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue