forked from I2P_Developers/i2p.i2p

* Added a pool of PRNGs using a different synchronization technique, hopefully sufficient to work around IBM's PRNG bugs until we get our own Fortuna. * In the streaming lib, don't jack up the RTT on NACK, and have the window size bound the not-yet-ready messages to the peer, not the unacked message count (not sure yet whether this is worthwile). * Many additions to the messageHistory log. * Handle out of order tunnel fragment delivery (not an issue on the live net with TCP, but critical with UDP). and for udp stuff: * implemented tcp-esque rto code in the udp transport * make sure we don't ACK too many messages at once * transmit fragments in a simple (nonrandom) order so that we can more easily adjust timeouts/etc. * let the active outbound pool grow dynamically if there are outbound slots to spare * use a simple decaying bloom filter at the UDP level to drop duplicate resent packets.
35 lines
1.3 KiB
Java
35 lines
1.3 KiB
Java
package net.i2p.router.tunnel;
|
|
|
|
import net.i2p.router.RouterContext;
|
|
import net.i2p.util.Log;
|
|
|
|
/**
|
|
* Minor extension to allow message history integration
|
|
*/
|
|
public class RouterFragmentHandler extends FragmentHandler {
|
|
private RouterContext _routerContext;
|
|
private Log _log;
|
|
|
|
public RouterFragmentHandler(RouterContext context, DefragmentedReceiver receiver) {
|
|
super(context, receiver);
|
|
_routerContext = context;
|
|
_log = context.logManager().getLog(RouterFragmentHandler.class);
|
|
}
|
|
|
|
protected void noteReception(long messageId, int fragmentId, String status) {
|
|
if (_log.shouldLog(Log.INFO))
|
|
_log.info("Received fragment " + fragmentId + " for message " + messageId + ": " + status);
|
|
_routerContext.messageHistory().receiveTunnelFragment(messageId, fragmentId, status);
|
|
}
|
|
protected void noteCompletion(long messageId) {
|
|
if (_log.shouldLog(Log.INFO))
|
|
_log.info("Received complete message " + messageId);
|
|
_routerContext.messageHistory().receiveTunnelFragmentComplete(messageId);
|
|
}
|
|
protected void noteFailure(long messageId, String status) {
|
|
if (_log.shouldLog(Log.INFO))
|
|
_log.info("Dropped message " + messageId + ": " + status);
|
|
_routerContext.messageHistory().droppedFragmentedMessage(messageId, status);
|
|
}
|
|
}
|