Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enforce datagram token buckets >= 0.

  • Loading branch information...
commit 00f38b9fce161b804443983b02c8eda69b0167c1 1 parent 548415e
@willscott willscott authored
View
1  ...warm_f2f/src/edu/washington/cs/oneswarm/f2f/datagram/DatagramRateLimitedChannelQueue.java
@@ -46,6 +46,7 @@ public void allocateTokens() {
@Override
public synchronized int refillBucket(int tokens) {
availableTokens += tokens;
+ assert (availableTokens >= 0);
if (logger.isLoggable(Level.FINEST)) {
logger.finest(toString() + ": refilling " + tokens + " tokens, available="
+ availableTokens);
View
2  oneswarm_f2f/src/edu/washington/cs/oneswarm/f2f/datagram/DatagramRateLimiter.java
@@ -9,7 +9,7 @@
public class DatagramRateLimiter {
public final static Logger logger = Logger.getLogger(DatagramRateLimiter.class.getName());
- protected volatile int availableTokens;
+ protected volatile int availableTokens = 0;
protected int maxAvailableTokens;
View
3  oneswarm_f2f/src/edu/washington/cs/oneswarm/f2f/servicesharing/ServiceConnection.java
@@ -296,6 +296,9 @@ public boolean channelGotMessage(ServiceChannelEndpoint sender, OSF2FServiceData
// Throw out to prevent buffer overflow.
logger.warning("Incoming service message dropped, exceeded message buffer.");
return true;
+ } else if (msg.getSequenceNumber() < serviceSequenceNumber) {
+ logger.info("Incoming service message dropped, already processed.");
+ return true;
} else {
DirectByteBuffer payload = msg.transferPayload();
if (payload.remaining(ss) > 0) {
Please sign in to comment.
Something went wrong with that request. Please try again.