I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit c02711cc authored by zzz's avatar zzz
Browse files

Fix socks so it uses existing tunnels rather than building a new one for every request.

Now works with or without 'shared clients' enabled.
parent 9885779c
No related branches found
No related tags found
No related merge requests found
...@@ -46,11 +46,11 @@ public class I2PSOCKSTunnel extends I2PTunnelClientBase { ...@@ -46,11 +46,11 @@ public class I2PSOCKSTunnel extends I2PTunnelClientBase {
try { try {
SOCKSServer serv = SOCKSServerFactory.createSOCKSServer(s); SOCKSServer serv = SOCKSServerFactory.createSOCKSServer(s);
Socket clientSock = serv.getClientSocket(); Socket clientSock = serv.getClientSocket();
I2PSocket destSock = serv.getDestinationI2PSocket(); I2PSocket destSock = serv.getDestinationI2PSocket(this);
new I2PTunnelRunner(clientSock, destSock, sockLock, null, mySockets); new I2PTunnelRunner(clientSock, destSock, sockLock, null, mySockets);
} catch (SOCKSException e) { } catch (SOCKSException e) {
_log.error("Error from SOCKS connection: " + e.getMessage()); _log.error("Error from SOCKS connection: " + e.getMessage());
closeSocket(s); closeSocket(s);
} }
} }
} }
\ No newline at end of file
...@@ -59,7 +59,7 @@ public abstract class SOCKSServer { ...@@ -59,7 +59,7 @@ public abstract class SOCKSServer {
* *
* @return an I2PSocket connected with the destination * @return an I2PSocket connected with the destination
*/ */
public I2PSocket getDestinationI2PSocket() throws SOCKSException { public I2PSocket getDestinationI2PSocket(I2PSOCKSTunnel t) throws SOCKSException {
setupServer(); setupServer();
if (connHostName == null) { if (connHostName == null) {
...@@ -79,8 +79,11 @@ public abstract class SOCKSServer { ...@@ -79,8 +79,11 @@ public abstract class SOCKSServer {
try { try {
if (connHostName.toLowerCase().endsWith(".i2p")) { if (connHostName.toLowerCase().endsWith(".i2p")) {
_log.debug("connecting to " + connHostName + "..."); _log.debug("connecting to " + connHostName + "...");
I2PSocketManager sm = I2PSocketManagerFactory.createManager(); // Let's not due a new Dest for every request, huh?
destSock = sm.connect(I2PTunnel.destFromName(connHostName), null); //I2PSocketManager sm = I2PSocketManagerFactory.createManager();
//destSock = sm.connect(I2PTunnel.destFromName(connHostName), null);
// TODO get the streaming lib options in there
destSock = t.createI2PSocket(I2PTunnel.destFromName(connHostName));
confirmConnection(); confirmConnection();
_log.debug("connection confirmed - exchanging data..."); _log.debug("connection confirmed - exchanging data...");
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment