diff --git a/apps/heartbeat/java/src/net/i2p/heartbeat/ClientConfig.java b/apps/heartbeat/java/src/net/i2p/heartbeat/ClientConfig.java index 9fadd2d74..59b9dfc87 100644 --- a/apps/heartbeat/java/src/net/i2p/heartbeat/ClientConfig.java +++ b/apps/heartbeat/java/src/net/i2p/heartbeat/ClientConfig.java @@ -358,7 +358,7 @@ public class ClientConfig { int sendFreq = getInt(sendFrequencyVal); int sendSize = getInt(sendSizeVal); - if ((duration <= 0) || (statFreq <= 0) || (sendFreq <= 0) || (sendSize <= 0)) { + if ((duration <= 0) || (statFreq <= 0) || (sendFreq < 0) || (sendSize <= 0)) { if (_log.shouldLog(Log.WARN)) { _log.warn("Invalid client config: duration [" + statDurationVal + "] stat frequency [" + statFrequencyVal + "] send frequency [" + sendFrequencyVal + "] send size [" @@ -424,7 +424,7 @@ public class ClientConfig { * @return true if it was stored correctly, false if there were errors */ public boolean store(Properties clientConfig, int peerNum) { - if ((_peer == null) || (_sendFrequency <= 0) || (_sendSize <= 0) || (_statDuration <= 0) + if ((_peer == null) || (_sendFrequency < 0) || (_sendSize <= 0) || (_statDuration <= 0) || (_statFrequency <= 0) || (_statFile == null)) { return false; } String comment = _comment; diff --git a/apps/heartbeat/java/src/net/i2p/heartbeat/ClientEngine.java b/apps/heartbeat/java/src/net/i2p/heartbeat/ClientEngine.java index b1b6ae83c..15caa0caf 100644 --- a/apps/heartbeat/java/src/net/i2p/heartbeat/ClientEngine.java +++ b/apps/heartbeat/java/src/net/i2p/heartbeat/ClientEngine.java @@ -120,9 +120,12 @@ class ClientEngine { _data.cleanup(); - try { - Thread.sleep(1000); - } catch (InterruptedException ie) { + long timeToWait = nextSend - Clock.getInstance().now(); + if (timeToWait > 0) { + try { + Thread.sleep(timeToWait); + } catch (InterruptedException ie) { + } } } }