* I2PTunnelUDPClientBase: Fix client close, client target host
* I2CP Mux: Fix UDP sends
This commit is contained in:
@ -213,8 +213,15 @@ public class TunnelController implements Logging {
|
||||
_tunnel.runStreamrClient(new String[] { targetHost, targetPort, dest }, this);
|
||||
}
|
||||
|
||||
/** Streamr server is a UDP client, use the targetPort field for listenPort */
|
||||
/**
|
||||
* Streamr server is a UDP client, use the targetPort field for listenPort
|
||||
* and the targetHost field for the listenOnInterface
|
||||
*/
|
||||
private void startStreamrServer() {
|
||||
String listenOn = getTargetHost();
|
||||
if ( (listenOn != null) && (listenOn.length() > 0) ) {
|
||||
_tunnel.runListenOn(new String[] { listenOn }, this);
|
||||
}
|
||||
String listenPort = getTargetPort();
|
||||
String privKeyFile = getPrivKeyFile();
|
||||
_tunnel.runStreamrServer(new String[] { listenPort, privKeyFile }, this);
|
||||
|
@ -42,6 +42,7 @@ public class StreamrConsumer extends I2PTunnelUDPClientBase {
|
||||
super.startRunning();
|
||||
// send subscribe-message
|
||||
this.pinger.start();
|
||||
l.log("Streamr client ready");
|
||||
}
|
||||
|
||||
public boolean close(boolean forced) {
|
||||
|
@ -48,6 +48,7 @@ public class StreamrProducer extends I2PTunnelUDPServerBase {
|
||||
public final void startRunning() {
|
||||
super.startRunning();
|
||||
this.server.start();
|
||||
l.log("Streamr server ready");
|
||||
}
|
||||
|
||||
public boolean close(boolean forced) {
|
||||
|
@ -27,7 +27,8 @@ public class I2PSinkAnywhere implements Sink {
|
||||
this.raw = raw;
|
||||
|
||||
// create maker
|
||||
this.maker = new I2PDatagramMaker(this.sess);
|
||||
if (!raw)
|
||||
this.maker = new I2PDatagramMaker(this.sess);
|
||||
}
|
||||
|
||||
/** @param to - where it's going */
|
||||
|
@ -141,9 +141,6 @@ public abstract class I2PTunnelUDPClientBase extends I2PTunnelTask implements So
|
||||
} else {
|
||||
_i2pSink = new I2PSinkAnywhere(_session, false);
|
||||
}
|
||||
|
||||
//configurePool(tunnel);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,13 +162,7 @@ public abstract class I2PTunnelUDPClientBase extends I2PTunnelTask implements So
|
||||
startRunning = true;
|
||||
startLock.notify();
|
||||
}
|
||||
|
||||
if (open && listenerReady) {
|
||||
notifyEvent("openBaseClientResult", "ok");
|
||||
} else {
|
||||
l.log("Error listening - please see the logs!");
|
||||
notifyEvent("openBaseClientResult", "error");
|
||||
}
|
||||
open = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,6 +178,7 @@ public abstract class I2PTunnelUDPClientBase extends I2PTunnelTask implements So
|
||||
} catch (I2PSessionException ise) {}
|
||||
}
|
||||
l.log("Closing client " + toString());
|
||||
open = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class I2PTunnelUDPServerBase extends I2PTunnelTask implements Source, Sin
|
||||
|
||||
private static volatile long __serverId = 0;
|
||||
|
||||
private Logging l;
|
||||
protected Logging l;
|
||||
|
||||
private static final long DEFAULT_READ_TIMEOUT = -1; // 3*60*1000;
|
||||
/** default timeout to 3 minutes - override if desired */
|
||||
@ -137,7 +137,6 @@ public class I2PTunnelUDPServerBase extends I2PTunnelTask implements Source, Sin
|
||||
start();
|
||||
//}
|
||||
|
||||
l.log("Ready!");
|
||||
notifyEvent("openServerResult", "ok");
|
||||
open = true;
|
||||
}
|
||||
|
@ -88,14 +88,16 @@
|
||||
<label>Target:</label>
|
||||
<% } %>
|
||||
</div>
|
||||
<% if (!"streamrserver".equals(tunnelType)) { %>
|
||||
<div id="hostField" class="rowItem">
|
||||
<label for="targetHost" accesskey="H">
|
||||
<% if ("streamrserver".equals(tunnelType)) { %>
|
||||
<span class="accessKey">R</span>eachable by:
|
||||
<% } else { %>
|
||||
<span class="accessKey">H</span>ost:
|
||||
<% } %>
|
||||
</label>
|
||||
<input type="text" size="20" id="targetHost" name="targetHost" title="Target Hostname or IP" value="<%=editBean.getTargetHost(curTunnel)%>" class="freetext" />
|
||||
</div>
|
||||
<% } // !streamrserver %>
|
||||
<div id="portField" class="rowItem">
|
||||
<label for="targetPort" accesskey="P">
|
||||
<span class="accessKey">P</span>ort:
|
||||
|
@ -118,12 +118,13 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
|
||||
|
||||
@Override
|
||||
public boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException {
|
||||
return sendMessage(dest, payload, 0, 0, null, null, 0, PROTO_UNSPECIFIED, PORT_UNSPECIFIED, PORT_UNSPECIFIED);
|
||||
return sendMessage(dest, payload, 0, payload.length, null, null,
|
||||
0, PROTO_UNSPECIFIED, PORT_UNSPECIFIED, PORT_UNSPECIFIED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendMessage(Destination dest, byte[] payload, int proto, int fromport, int toport) throws I2PSessionException {
|
||||
return sendMessage(dest, payload, 0, 0, null, null, 0, proto, fromport, toport);
|
||||
return sendMessage(dest, payload, 0, payload.length, null, null, 0, proto, fromport, toport);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user