forked from I2P_Developers/i2p.i2p
* i2ptunnel: Reduce buffer size and use cache in HTTPServer
* Jetty: Increase maxIdleTime
This commit is contained in:
@@ -21,7 +21,9 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
|
|
||||||
import net.i2p.client.streaming.I2PSocket;
|
import net.i2p.client.streaming.I2PSocket;
|
||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
|
import net.i2p.data.ByteArray;
|
||||||
import net.i2p.data.DataHelper;
|
import net.i2p.data.DataHelper;
|
||||||
|
import net.i2p.util.ByteCache;
|
||||||
import net.i2p.util.EventDispatcher;
|
import net.i2p.util.EventDispatcher;
|
||||||
import net.i2p.util.I2PAppThread;
|
import net.i2p.util.I2PAppThread;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
@@ -221,7 +223,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
// shadows _log in super()
|
// shadows _log in super()
|
||||||
private final Log _log;
|
private final Log _log;
|
||||||
|
|
||||||
private static final int BUF_SIZE = 16*1024;
|
private static final int BUF_SIZE = 8*1024;
|
||||||
|
|
||||||
public CompressedRequestor(Socket webserver, I2PSocket browser, String headers, I2PAppContext ctx, Log log) {
|
public CompressedRequestor(Socket webserver, I2PSocket browser, String headers, I2PAppContext ctx, Log log) {
|
||||||
_webserver = webserver;
|
_webserver = webserver;
|
||||||
@@ -245,6 +247,9 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
_log.info("request headers: " + _headers);
|
_log.info("request headers: " + _headers);
|
||||||
serverout.write(_headers.getBytes());
|
serverout.write(_headers.getBytes());
|
||||||
browserin = _browser.getInputStream();
|
browserin = _browser.getInputStream();
|
||||||
|
// TODO don't spin off a thread for this except for POSTs
|
||||||
|
// beware interference with Tahoe-LAFS, Shoutcast, etc.?
|
||||||
|
// if (browserin.available() == 0) ?
|
||||||
I2PAppThread sender = new I2PAppThread(new Sender(serverout, browserin, "server: browser to server", _log), Thread.currentThread().getName() + "hcs");
|
I2PAppThread sender = new I2PAppThread(new Sender(serverout, browserin, "server: browser to server", _log), Thread.currentThread().getName() + "hcs");
|
||||||
sender.start();
|
sender.start();
|
||||||
|
|
||||||
@@ -300,6 +305,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
private final String _name;
|
private final String _name;
|
||||||
// shadows _log in super()
|
// shadows _log in super()
|
||||||
private final Log _log;
|
private final Log _log;
|
||||||
|
private static final int BUF_SIZE = 8*1024;
|
||||||
|
private static final ByteCache _cache = ByteCache.getInstance(16, BUF_SIZE);
|
||||||
|
|
||||||
public Sender(OutputStream out, InputStream in, String name, Log log) {
|
public Sender(OutputStream out, InputStream in, String name, Log log) {
|
||||||
_out = out;
|
_out = out;
|
||||||
@@ -311,10 +318,11 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info(_name + ": Begin sending");
|
_log.info(_name + ": Begin sending");
|
||||||
|
ByteArray ba = _cache.acquire();
|
||||||
try {
|
try {
|
||||||
byte buf[] = new byte[16*1024];
|
byte buf[] = ba.getData();
|
||||||
int read = 0;
|
int read = 0;
|
||||||
int total = 0;
|
long total = 0;
|
||||||
while ( (read = _in.read(buf)) != -1) {
|
while ( (read = _in.read(buf)) != -1) {
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info(_name + ": read " + read + " and sending through the stream");
|
_log.info(_name + ": read " + read + " and sending through the stream");
|
||||||
@@ -328,6 +336,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Error sending", ioe);
|
_log.debug("Error sending", ioe);
|
||||||
} finally {
|
} finally {
|
||||||
|
_cache.release(ba);
|
||||||
if (_out != null) try { _out.close(); } catch (IOException ioe) {}
|
if (_out != null) try { _out.close(); } catch (IOException ioe) {}
|
||||||
if (_in != null) try { _in.close(); } catch (IOException ioe) {}
|
if (_in != null) try { _in.close(); } catch (IOException ioe) {}
|
||||||
}
|
}
|
||||||
|
10
history.txt
10
history.txt
@@ -1,11 +1,21 @@
|
|||||||
|
2013-09-03 zzz
|
||||||
|
* configui: Change pw restart warning to error so people dont miss it
|
||||||
|
* Data: deprecate most of LeaseSetKeys
|
||||||
|
* i2ptunnel: Reduce buffer size and use cache in HTTPServer
|
||||||
|
* Jetty: Increase maxIdleTime
|
||||||
|
* profiles: use different sort for floodfill profiles display
|
||||||
|
* Utils: Consolidate maxMemory() calls
|
||||||
|
|
||||||
2013-08-31 zab
|
2013-08-31 zab
|
||||||
* Streaming: Use only non-retransmitted packets when sampling RTT
|
* Streaming: Use only non-retransmitted packets when sampling RTT
|
||||||
(Ticket 1007, RFC 6298)
|
(Ticket 1007, RFC 6298)
|
||||||
|
|
||||||
2013-08-30 zzz
|
2013-08-30 zzz
|
||||||
|
* Addressbook: Don't write to log file on Android (ticket #859)
|
||||||
* Addresses: Treat Teredo addresses 2001:0::/32 as local
|
* Addresses: Treat Teredo addresses 2001:0::/32 as local
|
||||||
* Console: Display "accepting tunnels" instead of "rejecting tunnels"
|
* Console: Display "accepting tunnels" instead of "rejecting tunnels"
|
||||||
after 20 minutes (ticket #902)
|
after 20 minutes (ticket #902)
|
||||||
|
* i2psnark: Highlight table rows on hover
|
||||||
* NTCP: Handle race where peer's NTCP address goes away
|
* NTCP: Handle race where peer's NTCP address goes away
|
||||||
* SSU, confignet: Add support for specifiying multiple addresses
|
* SSU, confignet: Add support for specifiying multiple addresses
|
||||||
* SusiDNS: Don't require last subscription to be terminated by newline (ticket #1000)
|
* SusiDNS: Don't require last subscription to be terminated by newline (ticket #1000)
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
|
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
|
||||||
<Arg><Ref id="sslContextFactory" /></Arg>
|
<Arg><Ref id="sslContextFactory" /></Arg>
|
||||||
<Set name="Port">8443</Set>
|
<Set name="Port">8443</Set>
|
||||||
<Set name="maxIdleTime">30000</Set>
|
<Set name="maxIdleTime">600000</Set>
|
||||||
<Set name="useDirectBuffers">false</Set>
|
<Set name="useDirectBuffers">false</Set>
|
||||||
<Set name="Acceptors">2</Set>
|
<Set name="Acceptors">2</Set>
|
||||||
<Set name="AcceptQueueSize">100</Set>
|
<Set name="AcceptQueueSize">100</Set>
|
||||||
|
@@ -105,7 +105,7 @@
|
|||||||
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
|
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
|
||||||
<Set name="host">127.0.0.1</Set>
|
<Set name="host">127.0.0.1</Set>
|
||||||
<Set name="port">7658</Set>
|
<Set name="port">7658</Set>
|
||||||
<Set name="maxIdleTime">60000</Set>
|
<Set name="maxIdleTime">600000</Set>
|
||||||
<Set name="Acceptors">1</Set>
|
<Set name="Acceptors">1</Set>
|
||||||
<Set name="statsOn">false</Set>
|
<Set name="statsOn">false</Set>
|
||||||
<Set name="confidentialPort">8443</Set>
|
<Set name="confidentialPort">8443</Set>
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
<New class="org.eclipse.jetty.server.bio.SocketConnector">
|
<New class="org.eclipse.jetty.server.bio.SocketConnector">
|
||||||
<Set name="host">127.0.0.1</Set>
|
<Set name="host">127.0.0.1</Set>
|
||||||
<Set name="port">7658</Set>
|
<Set name="port">7658</Set>
|
||||||
<Set name="maxIdleTime">60000</Set>
|
<Set name="maxIdleTime">600000</Set>
|
||||||
<Set name="Acceptors">1</Set>
|
<Set name="Acceptors">1</Set>
|
||||||
<Set name="statsOn">false</Set>
|
<Set name="statsOn">false</Set>
|
||||||
<Set name="confidentialPort">8443</Set>
|
<Set name="confidentialPort">8443</Set>
|
||||||
|
@@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 22;
|
public final static long BUILD = 23;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user