Changeset 10f2d83 for router


Ignore:
Timestamp:
Jan 12, 2019 1:45:38 PM (17 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
4283d71
Parents:
f5ca17c
Message:

SSU: More consolidation of clock().now() calls

Location:
router/java/src/net/i2p/router/transport/udp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/udp/OutboundMessageFragments.java

    rf5ca17c r10f2d83  
    287287                    // Otherwise, return the volley to be sent.
    288288                    // Otherwise, wait()
     289                    long now = _context.clock().now();
    289290                    while (_iterator.hasNext()) {
    290291                        peer = _iterator.next();
    291                         int remaining = peer.finishMessages();
     292                        int remaining = peer.finishMessages(now);
    292293                        if (remaining <= 0) {
    293294                            // race with add()
  • router/java/src/net/i2p/router/transport/udp/OutboundMessageState.java

    rf5ca17c r10f2d83  
    117117    }
    118118
     119    /**
     120     * @since 0.9.38
     121     */
     122    public boolean isExpired(long now) {
     123        return _expiration < now;
     124    }
     125
    119126    public synchronized boolean isComplete() {
    120127        return _fragmentAcks == 0;
  • router/java/src/net/i2p/router/transport/udp/PeerState.java

    rf5ca17c r10f2d83  
    15611561     * @return number of active outbound messages remaining
    15621562     */
    1563     public int finishMessages() {
     1563    public int finishMessages(long now) {
    15641564        // short circuit, unsynchronized
    15651565        if (_outboundMessages.isEmpty())
     
    15831583                    if (succeeded == null) succeeded = new ArrayList<OutboundMessageState>(4);
    15841584                    succeeded.add(state);
    1585                 } else if (state.isExpired()) {
     1585                } else if (state.isExpired(now)) {
    15861586                    iter.remove();
    15871587                    if (_retransmitter == state)
     
    17901790        if (state.getNextSendTime() <= now) {
    17911791            OutboundMessageState retrans = _retransmitter;
    1792             if ( (retrans != null) && ( (retrans.isExpired() || retrans.isComplete()) ) ) {
     1792            if ( (retrans != null) && ( (retrans.isExpired(now) || retrans.isComplete()) ) ) {
    17931793                _retransmitter = null;
    17941794                retrans = null;
Note: See TracChangeset for help on using the changeset viewer.