Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

prevent divide-by-zeros in friend connection.

  • Loading branch information...
commit 5204d0834d81f860f7570d29537179b474d01ea2 1 parent 6b4b9f1
@willscott willscott authored
View
8 oneswarm_f2f/src/edu/washington/cs/oneswarm/f2f/network/FriendConnection.java
@@ -746,17 +746,21 @@ public int getRemotePublicKeyHash() {
public int getSendQueueCurrentCapacity(int channelId) {
if (udpConnection != null && udpConnection.isSendingActive()) {
return udpConnection.getCapacityForChannel(channelId);
- } else {
+ } else if (this.overlayTransports.size() > 0) {
return (FriendConnectionQueue.MAX_FRIEND_QUEUE_LENGTH - friendConnectionQueue
.getForwardQueueBytes()) / this.overlayTransports.size();
+ } else {
+ return 0;
}
}
public int getSendQueuePotentialCapacity(int channelId) {
if (udpConnection != null && udpConnection.isSendingActive()) {
return udpConnection.getPotentialCapacityForChannel(channelId);
- } else {
+ } else if (this.overlayTransports.size() > 0) {
return (FriendConnectionQueue.MAX_FRIEND_QUEUE_LENGTH) / this.overlayTransports.size();
+ } else {
+ return 0;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.