NTCP: Enable nodelay by default

SSU: Don't wakeup OMF after ack if no more messages are pending
This commit is contained in:
zzz
2020-11-26 18:58:22 +00:00
parent 4940c34779
commit 6c2c6abfb9
4 changed files with 31 additions and 8 deletions

View File

@@ -1,3 +1,7 @@
2020-11-26 zzz
* NTCP: Enable nodelay by default
* SSU: Don't wakeup OMF after ack if no more messages are pending
2020-11-24 zzz
* Build: Fix targets for git
* NTCP: Add nodelay option for testing

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 17;
public final static long BUILD = 18;
/** for example "-test" */
public final static String EXTRA = "-rc";

View File

@@ -130,7 +130,7 @@ class EventPumper implements Runnable {
_context.statManager().createRateStat("ntcp.zeroRead", "", "ntcp", new long[] {10*60*1000} );
_context.statManager().createRateStat("ntcp.zeroReadDrop", "", "ntcp", new long[] {10*60*1000} );
_context.statManager().createRateStat("ntcp.dropInboundNoMessage", "", "ntcp", new long[] {10*60*1000} );
_nodelay = ctx.getBooleanProperty(PROP_NODELAY);
_nodelay = ctx.getBooleanPropertyDefaultTrue(PROP_NODELAY);
}
public synchronized void startPumping() {

View File

@@ -1190,7 +1190,7 @@ public class PeerState {
* We sent a message which was ACKed containing the given # of bytes.
* Caller should synch on this
*/
private void locked_messageACKed(int bytesACKed, long lifetime, int numSends, boolean anyPending) {
private void locked_messageACKed(int bytesACKed, long lifetime, int numSends, boolean anyPending, boolean anyQueued) {
_consecutiveFailedSends = 0;
// _lastFailedSendPeriod = -1;
if (numSends < 2) {
@@ -1248,15 +1248,16 @@ public class PeerState {
if (_log.shouldLog(Log.DEBUG))
_log.debug(_remotePeer + " ACK, timer: " + oldTimer + " -> " + (_retransmitTimer - now));
}
_transport.getOMF().nudge();
if (anyPending || anyQueued)
_transport.getOMF().nudge();
}
/**
* We sent a message which was ACKed containing the given # of bytes.
*/
private void messageACKed(int bytesACKed, long lifetime, int numSends, boolean anyPending) {
private void messageACKed(int bytesACKed, long lifetime, int numSends, boolean anyPending, boolean anyQueued) {
synchronized(this) {
locked_messageACKed(bytesACKed, lifetime, numSends, anyPending);
locked_messageACKed(bytesACKed, lifetime, numSends, anyPending, anyQueued);
}
if (numSends >= 2 && _log.shouldLog(Log.INFO))
_log.info(_remotePeer + " acked after numSends=" + numSends + " w/ lifetime=" + lifetime + " and size=" + bytesACKed);
@@ -1903,8 +1904,17 @@ public class PeerState {
_context.statManager().addRateData("udp.sendConfirmFragments", state.getFragmentCount());
_context.statManager().addRateData("udp.sendConfirmVolley", numSends);
_transport.succeeded(state);
boolean anyQueued;
if (anyPending) {
// locked_messageACKed will nudge()
anyQueued = false;
} else {
synchronized (_outboundQueue) {
anyQueued = !_outboundQueue.isEmpty();
}
}
// this adjusts the rtt/rto/window/etc
messageACKed(state.getMessageSize(), state.getLifetime(), numSends, anyPending);
messageACKed(state.getMessageSize(), state.getLifetime(), numSends, anyPending, anyQueued);
//if (getSendWindowBytesRemaining() > 0)
// _throttle.unchoke(peer.getRemotePeer());
@@ -1975,8 +1985,17 @@ public class PeerState {
// state.getMessage().timestamp("partial ack to complete after " + numSends);
_transport.succeeded(state);
boolean anyQueued;
if (anyPending) {
// locked_messageACKed will nudge()
anyQueued = false;
} else {
synchronized (_outboundQueue) {
anyQueued = !_outboundQueue.isEmpty();
}
}
// this adjusts the rtt/rto/window/etc
messageACKed(state.getMessageSize(), state.getLifetime(), numSends, anyPending);
messageACKed(state.getMessageSize(), state.getLifetime(), numSends, anyPending, anyQueued);
//if (state.getPeer().getSendWindowBytesRemaining() > 0)
// _throttle.unchoke(state.getPeer().getRemotePeer());