From 60bd9803f0780c5568900259a9cd5ee02f959830 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 10 Jan 2009 22:30:43 +0000
Subject: [PATCH] fix burst seconds display

---
 .../net/i2p/router/web/ConfigNetHelper.java   | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java
index b648d96075..d355e9d61c 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java
@@ -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();
-- 
GitLab