fix burst seconds display

This commit is contained in:
zzz
2009-01-10 22:30:43 +00:00
parent c3360cc3d7
commit 60bd9803f0

View File

@ -156,7 +156,7 @@ public class ConfigNetHelper {
public String getInboundBurstFactorBox() {
int numSeconds = 1;
int rateKBps = _context.bandwidthLimiter().getInboundBurstKBytesPerSecond();
int burstKB = _context.bandwidthLimiter().getInboundBurstBytes() * 1024;
int burstKB = _context.bandwidthLimiter().getInboundBurstBytes() / 1024;
if ( (rateKBps > 0) && (burstKB > 0) )
numSeconds = burstKB / rateKBps;
return getBurstFactor(numSeconds, "inboundburstfactor");
@ -165,7 +165,7 @@ public class ConfigNetHelper {
public String getOutboundBurstFactorBox() {
int numSeconds = 1;
int rateKBps = _context.bandwidthLimiter().getOutboundBurstKBytesPerSecond();
int burstKB = _context.bandwidthLimiter().getOutboundBurstBytes() * 1024;
int burstKB = _context.bandwidthLimiter().getOutboundBurstBytes() / 1024;
if ( (rateKBps > 0) && (burstKB > 0) )
numSeconds = burstKB / rateKBps;
return getBurstFactor(numSeconds, "outboundburstfactor");
@ -175,16 +175,21 @@ public class ConfigNetHelper {
StringBuffer buf = new StringBuffer(256);
buf.append("<select name=\"").append(name).append("\">\n");
boolean found = false;
for (int i = 10; i <= 60; i += 10) {
buf.append("<option value=\"").append(i).append("\" ");
if (i == numSeconds) {
for (int i = 10; i <= 70; i += 10) {
int val = i;
if (i == 70) {
if (found)
break;
else
val = numSeconds;
}
buf.append("<option value=\"").append(val).append("\" ");
if (val == numSeconds) {
buf.append("selected ");
found = true;
} else if ( (i == 60) && (!found) ) {
buf.append("selected ");
}
buf.append(">");
buf.append(i).append(" seconds</option>\n");
buf.append(val).append(" seconds</option>\n");
}
buf.append("</select>\n");
return buf.toString();