mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-27 00:32:07 +01:00
Cleanup listening socket
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7617 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
c95c8b7e3a
commit
02b6924b99
1 changed files with 18 additions and 12 deletions
|
@ -281,22 +281,28 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
|
||||||
process = null;
|
process = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String localIP;
|
Socket conn;
|
||||||
try {
|
try {
|
||||||
localIP = discoverLocalIP();
|
String localIP;
|
||||||
|
try {
|
||||||
|
localIP = discoverLocalIP();
|
||||||
|
}
|
||||||
|
catch (UnknownHostException e1) {
|
||||||
|
localIP = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bytestream query = createByteStreamInit(initiator, target, sessionID,
|
||||||
|
localIP, (process != null ? process.getPort() : 0));
|
||||||
|
|
||||||
|
// if the local host is one of the options we need to wait for the
|
||||||
|
// remote connection.
|
||||||
|
conn = waitForUsedHostResponse(sessionID, process, createDigest(
|
||||||
|
sessionID, initiator, target), query).establishedSocket;
|
||||||
}
|
}
|
||||||
catch (UnknownHostException e1) {
|
finally {
|
||||||
localIP = null;
|
cleanupListeningSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bytestream query = createByteStreamInit(initiator, target, sessionID,
|
|
||||||
localIP, (process != null ? process.getPort() : 0));
|
|
||||||
|
|
||||||
// if the local host is one of the options we need to wait for the
|
|
||||||
// remote connection.
|
|
||||||
Socket conn = waitForUsedHostResponse(sessionID, process, createDigest(
|
|
||||||
sessionID, initiator, target), query).establishedSocket;
|
|
||||||
cleanupListeningSocket();
|
|
||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue