From 8dd31db2eae90764bac5ddcc7ab4ed25e9d39817 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 13 Aug 2013 21:49:15 +0000 Subject: - mq,mesh,consensus,millisecond time --- src/org/gnunet/consensus/ConcludeDoneMessage.java | 3 +- src/org/gnunet/consensus/Consensus.java | 20 +++++++- src/org/gnunet/construct/MsgMap.txt | 11 ++--- src/org/gnunet/mesh/Mesh.java | 24 ++++++++-- src/org/gnunet/mq/ClientMessageQueue.java | 4 -- src/org/gnunet/util/AbsoluteTime.java | 55 +++++++++++----------- src/org/gnunet/util/AbsoluteTimeMessage.java | 2 +- src/org/gnunet/util/Configuration.java | 6 ++- src/org/gnunet/util/Connection.java | 2 +- src/org/gnunet/util/RelativeTime.java | 56 ++++++++++++----------- src/org/gnunet/util/RelativeTimeMessage.java | 2 +- src/org/gnunet/util/Scheduler.java | 10 ++-- 12 files changed, 118 insertions(+), 77 deletions(-) (limited to 'src') diff --git a/src/org/gnunet/consensus/ConcludeDoneMessage.java b/src/org/gnunet/consensus/ConcludeDoneMessage.java index 3b016cf..51757aa 100644 --- a/src/org/gnunet/consensus/ConcludeDoneMessage.java +++ b/src/org/gnunet/consensus/ConcludeDoneMessage.java @@ -1,6 +1,7 @@ package org.gnunet.consensus; +import org.gnunet.construct.MessageUnion; import org.gnunet.construct.UnionCase; /** @@ -8,5 +9,5 @@ import org.gnunet.construct.UnionCase; * Direction: service -> client */ @UnionCase(525) -public class ConcludeDoneMessage { +public class ConcludeDoneMessage implements MessageUnion { } diff --git a/src/org/gnunet/consensus/Consensus.java b/src/org/gnunet/consensus/Consensus.java index e6fab01..2047454 100644 --- a/src/org/gnunet/consensus/Consensus.java +++ b/src/org/gnunet/consensus/Consensus.java @@ -85,6 +85,12 @@ public class Consensus { this.newElementCallback = newElementCallback; } + /** + * Insert an element into the consensus set. + * + * @param element element to insert in the consnesus + * @param idc called when the element has been sent to the service + */ public void insertElement (ConsensusElement element, final InsertDoneCallback idc) { InsertElementMessage m = new InsertElementMessage(); m.element_data = element.data; @@ -99,17 +105,27 @@ public class Consensus { client_mq.send(ev); } + /** + * We are done with inserting new elements into the consensus; + * try to conclude the consensus within a given time window. + * After conclude has been called, no further elements may be + * inserted by the client. + * @param concludeCallback called when the consensus has concluded + */ public void conclude(ConcludeCallback concludeCallback) { if (null == concludeCallback) throw new AssertionError("conclude with empty callback"); if (null != this.concludeCallback) throw new AssertionError("called conclude twice"); this.concludeCallback = concludeCallback; + ConcludeMessage m = new ConcludeMessage(); + client_mq.send(m); } /** - * Destroy a consensus handle (free all state associated with - * it, no longer call any of the callbacks). + * Destroy a consensus handle. + * Free all state associated with + * it, no longer call any of the callbacks. */ public void destroy() { client_mq.destroy(); diff --git a/src/org/gnunet/construct/MsgMap.txt b/src/org/gnunet/construct/MsgMap.txt index 30e7077..7f3d2f4 100644 --- a/src/org/gnunet/construct/MsgMap.txt +++ b/src/org/gnunet/construct/MsgMap.txt @@ -1,7 +1,6 @@ org.gnunet.util.Resolver$Address|0=org.gnunet.util.Resolver$TextualAddress org.gnunet.util.Resolver$Address|1=org.gnunet.util.Resolver$NumericAddress org.gnunet.util.GnunetMessage$Body|68=org.gnunet.core.DisconnectNotifyMessage -org.gnunet.util.GnunetMessage$Body|275=org.gnunet.mesh.PeerAddMessage org.gnunet.util.GnunetMessage$Body|274=org.gnunet.mesh.TunnelDestroyMessage org.gnunet.util.GnunetMessage$Body|1=org.gnunet.util.TestMessage org.gnunet.util.GnunetMessage$Body|70=org.gnunet.core.NotifyInboundTrafficMessage @@ -12,10 +11,8 @@ org.gnunet.util.GnunetMessage$Body|64=org.gnunet.core.InitMessage org.gnunet.util.GnunetMessage$Body|4=org.gnunet.util.Resolver$GetMessage org.gnunet.util.GnunetMessage$Body|65=org.gnunet.core.InitReplyMessage org.gnunet.util.GnunetMessage$Body|5=org.gnunet.util.Resolver$ResolverResponse -org.gnunet.util.GnunetMessage$Body|277=org.gnunet.mesh.ConnectPeerByTypeMessage org.gnunet.util.GnunetMessage$Body|143=org.gnunet.dht.ClientGetMessage org.gnunet.util.GnunetMessage$Body|67=org.gnunet.core.ConnectNotifyMessage -org.gnunet.util.GnunetMessage$Body|276=org.gnunet.mesh.PeerDeleteMessage org.gnunet.util.GnunetMessage$Body|142=org.gnunet.dht.ClientPutMessage org.gnunet.util.GnunetMessage$Body|76=org.gnunet.core.SendMessage org.gnunet.util.GnunetMessage$Body|286=org.gnunet.mesh.LocalAckMessage @@ -23,10 +20,8 @@ org.gnunet.util.GnunetMessage$Body|74=org.gnunet.core.SendMessageRequest org.gnunet.util.GnunetMessage$Body|75=org.gnunet.core.SendMessageReady org.gnunet.util.GnunetMessage$Body|153=org.gnunet.dht.MonitorStartStop org.gnunet.util.GnunetMessage$Body|155=org.gnunet.dht.ClientPutConfirmationMessage -org.gnunet.util.GnunetMessage$Body|262=org.gnunet.mesh.OriginMessage org.gnunet.util.GnunetMessage$Body|323=org.gnunet.nse.UpdateMessage org.gnunet.util.GnunetMessage$Body|260=org.gnunet.mesh.DataMessage -org.gnunet.util.GnunetMessage$Body|261=org.gnunet.mesh.MulticastMessage org.gnunet.util.GnunetMessage$Body|321=org.gnunet.nse.StartMessage org.gnunet.util.GnunetMessage$Body|144=org.gnunet.dht.ClientGetStopMessage org.gnunet.util.GnunetMessage$Body|145=org.gnunet.dht.ClientResultMessage @@ -43,5 +38,9 @@ org.gnunet.util.GnunetMessage$Body|168=org.gnunet.statistics.SetMessage org.gnunet.util.GnunetMessage$Body|374=org.gnunet.transport.RequestConnectMessage org.gnunet.util.GnunetMessage$Body|173=org.gnunet.statistics.WatchResponseMessage org.gnunet.util.GnunetMessage$Body|172=org.gnunet.statistics.WatchMessage +org.gnunet.util.GnunetMessage$Body|524=org.gnunet.consensus.ConcludeMessage +org.gnunet.util.GnunetMessage$Body|521=org.gnunet.consensus.InsertElementMessage +org.gnunet.util.GnunetMessage$Body|523=org.gnunet.consensus.NewElementMessage org.gnunet.util.GnunetMessage$Body|360=org.gnunet.transport.StartMessage -# generated 2013/04/14 22:27:05 +org.gnunet.construct.MessageUnion|525=org.gnunet.consensus.ConcludeDoneMessage +# generated 2013/08/13 20:15:12 diff --git a/src/org/gnunet/mesh/Mesh.java b/src/org/gnunet/mesh/Mesh.java index 091cb17..b272b0b 100644 --- a/src/org/gnunet/mesh/Mesh.java +++ b/src/org/gnunet/mesh/Mesh.java @@ -116,6 +116,7 @@ public class Mesh { * @param type of context data for the tunnel */ public class Tunnel extends MessageQueue { + private T context; private final int opt; public final PeerIdentity peer; public final int port; @@ -194,8 +195,16 @@ public class Mesh { client_mq.send(mesh_ev); ack_count -= 1; } - } + public T getContext() { + return context; + } + + public void setContext(T newContext) { + context = newContext; + } + + } private class MeshMessageReceiver extends RunaboutMessageReceiver { public void visit(TunnelCreateMessage m) { @@ -235,11 +244,19 @@ public class Mesh { @Override public void handleError() { - // todo: re-establish all tunnels + if (tunnelEndHandler != null) { + for (Tunnel t : tunnelMap.values()) { + tunnelEndHandler.onTunnelEnd(t); + } + } + tunnelMap.clear(); + client.reconnect(); + ClientConnectMessage ccm = new ClientConnectMessage(); + ccm.apps_list = ports; + client_mq.send(ccm); } } - /** * Connect to the mesh service. * @@ -263,7 +280,6 @@ public class Mesh { client_mq.send(ccm); } - /** * Disconnect from the mesh service. * All tunnels will be destroyed. diff --git a/src/org/gnunet/mq/ClientMessageQueue.java b/src/org/gnunet/mq/ClientMessageQueue.java index bfb0466..b3fccc7 100644 --- a/src/org/gnunet/mq/ClientMessageQueue.java +++ b/src/org/gnunet/mq/ClientMessageQueue.java @@ -11,18 +11,15 @@ public class ClientMessageQueue extends MessageQueue { private final Client client; private final RunaboutMessageReceiver receiver; - public ClientMessageQueue(Client client, RunaboutMessageReceiver receiver) { this.client = client; this.receiver = receiver; } - public ClientMessageQueue(Client client) { this(client, null); } - @Override protected void sendImmediate(final Envelope ev) { int size = Construct.getSize(ev.message); @@ -40,7 +37,6 @@ public class ClientMessageQueue extends MessageQueue { }); } - @Override public void destroy() { diff --git a/src/org/gnunet/util/AbsoluteTime.java b/src/org/gnunet/util/AbsoluteTime.java index cea0366..06f41ac 100644 --- a/src/org/gnunet/util/AbsoluteTime.java +++ b/src/org/gnunet/util/AbsoluteTime.java @@ -40,6 +40,11 @@ public class AbsoluteTime implements Comparable { public final static AbsoluteTime ZERO = new AbsoluteTime(0); public final static AbsoluteTime FOREVER = new AbsoluteTime(Long.MAX_VALUE); + /** + * Absolute time value in microseconds. + */ + private final long abs_value_us; + /** * Gets the current time. * @@ -49,10 +54,8 @@ public class AbsoluteTime implements Comparable { return new AbsoluteTime(System.currentTimeMillis()); } - private final long abs_value; - - public AbsoluteTime(final long abs_value) { - this.abs_value = abs_value; + public AbsoluteTime(final long abs_value_us) { + this.abs_value_us = abs_value_us; } /** @@ -62,14 +65,14 @@ public class AbsoluteTime implements Comparable { * @return {@literal this + duration} */ public AbsoluteTime add(RelativeTime duration) { - if (abs_value == Long.MAX_VALUE + if (abs_value_us == Long.MAX_VALUE || duration.isForever()) { return AbsoluteTime.FOREVER; } - if (abs_value + duration.getMilliseconds() < abs_value) { + if (abs_value_us + duration.getMicroseconds() < abs_value_us) { return AbsoluteTime.FOREVER; } - return new AbsoluteTime(abs_value + duration.getMilliseconds()); + return new AbsoluteTime(abs_value_us + duration.getMicroseconds()); } /** @@ -93,7 +96,7 @@ public class AbsoluteTime implements Comparable { return RelativeTime.FOREVER; } final RelativeTime dur = start.getDuration(); - final double exp = dur.getMilliseconds() * total + final double exp = dur.getMicroseconds() * total / (double) finished; return new RelativeTime((long) exp); } @@ -112,7 +115,7 @@ public class AbsoluteTime implements Comparable { */ @Override public int hashCode() { - return (int) this.abs_value; + return (int) this.abs_value_us; } /** @@ -120,10 +123,10 @@ public class AbsoluteTime implements Comparable { */ @Override public int compareTo(AbsoluteTime other) { - if (this.abs_value < other.abs_value) { + if (this.abs_value_us < other.abs_value_us) { return -1; } - if (this.abs_value > other.abs_value) { + if (this.abs_value_us > other.abs_value_us) { return 1; } return 0; @@ -137,7 +140,7 @@ public class AbsoluteTime implements Comparable { if (this.isForever()) { return "AbsoluteTime(FOREVER)"; } - return "AbsoluteTime("+this.abs_value+")"; + return "AbsoluteTime("+this.abs_value_us +")"; } @@ -146,7 +149,7 @@ public class AbsoluteTime implements Comparable { * @return true if NOW is greater than the given time, false otherwise */ public boolean isDue() { - return this.abs_value < now().abs_value; + return this.abs_value_us < now().abs_value_us; } /** @@ -155,7 +158,7 @@ public class AbsoluteTime implements Comparable { * @return this==FOREVER */ public boolean isForever() { - return this.abs_value == Long.MAX_VALUE; + return this.abs_value_us == Long.MAX_VALUE; } /** @@ -165,10 +168,10 @@ public class AbsoluteTime implements Comparable { * @return this - other */ public RelativeTime getDifference(final AbsoluteTime other) { - if (other.abs_value == Long.MAX_VALUE) { + if (other.abs_value_us == Long.MAX_VALUE) { return RelativeTime.FOREVER; } - return new RelativeTime(abs_value - other.abs_value); + return new RelativeTime(abs_value_us - other.abs_value_us); } /** @@ -178,7 +181,7 @@ public class AbsoluteTime implements Comparable { * @return this - now */ public RelativeTime getDuration() { - assert abs_value != Long.MAX_VALUE; + assert abs_value_us != Long.MAX_VALUE; return getDifference(AbsoluteTime.now()); } @@ -187,8 +190,8 @@ public class AbsoluteTime implements Comparable { * * @return the absolute time in milliseconds */ - public long getMilliseconds() { - return abs_value; + public long getMicroseconds() { + return abs_value_us; } /** @@ -197,7 +200,7 @@ public class AbsoluteTime implements Comparable { * @return this - now */ public RelativeTime getRemaining() { - if (abs_value == Long.MAX_VALUE) { + if (abs_value_us == Long.MAX_VALUE) { return RelativeTime.FOREVER; } return getDifference(AbsoluteTime.now()); @@ -210,7 +213,7 @@ public class AbsoluteTime implements Comparable { * @return max(this,other) */ public AbsoluteTime max(final AbsoluteTime other) { - return abs_value >= other.abs_value ? this : other; + return abs_value_us >= other.abs_value_us ? this : other; } @@ -221,7 +224,7 @@ public class AbsoluteTime implements Comparable { * @return min(this,other) */ public AbsoluteTime min(final AbsoluteTime other) { - return abs_value <= other.abs_value ? this : other; + return abs_value_us <= other.abs_value_us ? this : other; } /** @@ -231,13 +234,13 @@ public class AbsoluteTime implements Comparable { * @return this - duration */ public AbsoluteTime subtract(final RelativeTime duration) { - if (abs_value <= duration.getMilliseconds()) { + if (abs_value_us <= duration.getMicroseconds()) { return AbsoluteTime.ZERO; } - if (abs_value == Long.MAX_VALUE) { + if (abs_value_us == Long.MAX_VALUE) { return this; } - return new AbsoluteTime(abs_value - duration.getMilliseconds()); + return new AbsoluteTime(abs_value_us - duration.getMicroseconds()); } /** @@ -261,6 +264,6 @@ public class AbsoluteTime implements Comparable { } public Date toDate() { - return new Date(abs_value); + return new Date(abs_value_us); } } diff --git a/src/org/gnunet/util/AbsoluteTimeMessage.java b/src/org/gnunet/util/AbsoluteTimeMessage.java index 8ddcc9b..f46d577 100644 --- a/src/org/gnunet/util/AbsoluteTimeMessage.java +++ b/src/org/gnunet/util/AbsoluteTimeMessage.java @@ -41,7 +41,7 @@ public class AbsoluteTimeMessage implements Message { if (t.equals(AbsoluteTime.FOREVER)) { this.value__ = -1; } else { - this.value__ = t.getMilliseconds(); + this.value__ = t.getMicroseconds(); } } } diff --git a/src/org/gnunet/util/Configuration.java b/src/org/gnunet/util/Configuration.java index ed12ff3..5cf950c 100644 --- a/src/org/gnunet/util/Configuration.java +++ b/src/org/gnunet/util/Configuration.java @@ -250,8 +250,12 @@ public class Configuration { while (it.hasNext()) { String line = it.next(); + String[] split_line = line.split("#"); + if (split_line.length == 0) + continue; + // strip comment - line = line.split("#")[0]; + line = split_line[0]; Matcher m; if ((m = tag.matcher(line)).matches()) { diff --git a/src/org/gnunet/util/Connection.java b/src/org/gnunet/util/Connection.java index 8e0c401..f969cbe 100644 --- a/src/org/gnunet/util/Connection.java +++ b/src/org/gnunet/util/Connection.java @@ -596,7 +596,7 @@ public class Connection { "previous transmit request must have completed before calling notifyTransmitReady again"); } - if (timeout.getMilliseconds() <= 0) { + if (timeout.getMicroseconds() <= 0) { throw new AssertionError("notifyTransmitReady timeout must be positive"); } diff --git a/src/org/gnunet/util/RelativeTime.java b/src/org/gnunet/util/RelativeTime.java index 7b45bb0..0faedfc 100644 --- a/src/org/gnunet/util/RelativeTime.java +++ b/src/org/gnunet/util/RelativeTime.java @@ -32,7 +32,8 @@ public final class RelativeTime implements Comparable { private static final Logger logger = LoggerFactory .getLogger(RelativeTime.class); - public static final RelativeTime MILLISECOND = new RelativeTime(1); + public static final RelativeTime MICROSECOND = new RelativeTime(1); + public static final RelativeTime MILLISECOND = MICROSECOND.multiply(1000); public static final RelativeTime SECOND = MILLISECOND.multiply(1000); public static final RelativeTime MINUTE = SECOND.multiply(60); public static final RelativeTime HOUR = MINUTE.multiply(60); @@ -44,7 +45,10 @@ public final class RelativeTime implements Comparable { public static final RelativeTime ZERO = new RelativeTime(0); public static final RelativeTime FOREVER = new RelativeTime(Long.MAX_VALUE); - private final long rel_value; + /** + * Time offset in microseconds. + */ + private final long rel_value_us; /** * Create a new RelativeTime value, with a given time in milliseconds. @@ -52,7 +56,7 @@ public final class RelativeTime implements Comparable { * @param abs_value time in milliseconds */ public RelativeTime(final long abs_value) { - this.rel_value = abs_value; + this.rel_value_us = abs_value; } /** @@ -64,13 +68,13 @@ public final class RelativeTime implements Comparable { * @return this + other */ public RelativeTime add(final RelativeTime other) { - if (this.rel_value == Long.MAX_VALUE - || other.rel_value == Long.MAX_VALUE) { + if (this.rel_value_us == Long.MAX_VALUE + || other.rel_value_us == Long.MAX_VALUE) { return RelativeTime.FOREVER; } - final long new_rel_value = this.rel_value + other.rel_value; + final long new_rel_value = this.rel_value_us + other.rel_value_us; // check for numeric overflow - if (new_rel_value < this.rel_value) { + if (new_rel_value < this.rel_value_us) { logger.warn("time overflow"); return RelativeTime.FOREVER; } @@ -85,10 +89,10 @@ public final class RelativeTime implements Comparable { * @return FOREVER if this=FOREVER or factor=0; otherwise this/factor */ public RelativeTime divide(final int factor) { - if (factor == 0 || this.rel_value == Long.MAX_VALUE) { + if (factor == 0 || this.rel_value_us == Long.MAX_VALUE) { return RelativeTime.FOREVER; } - return new RelativeTime(this.rel_value / factor); + return new RelativeTime(this.rel_value_us / factor); } /** @@ -96,8 +100,8 @@ public final class RelativeTime implements Comparable { * * @return the amount of time in milliseconds */ - public long getMilliseconds() { - return rel_value; + public long getMicroseconds() { + return rel_value_us; } /** @@ -106,7 +110,7 @@ public final class RelativeTime implements Comparable { * @return max(t1, t2) */ public static RelativeTime max(RelativeTime t1, RelativeTime t2) { - return t1.rel_value >= t2.rel_value ? t1 : t2; + return t1.rel_value_us >= t2.rel_value_us ? t1 : t2; } /** @@ -115,7 +119,7 @@ public final class RelativeTime implements Comparable { * @return min(this, other) */ public static RelativeTime min(RelativeTime t1, RelativeTime t2) { - return t1.rel_value <= t2.rel_value ? t1 : t2; + return t1.rel_value_us <= t2.rel_value_us ? t1 : t2; } /** @@ -127,9 +131,9 @@ public final class RelativeTime implements Comparable { if (factor == 0) { return RelativeTime.ZERO; } - final long ret = this.rel_value * factor; + final long ret = this.rel_value_us * factor; // check for numeric overflow - if (ret / factor != rel_value) { + if (ret / factor != rel_value_us) { logger.warn("time overflow"); return RelativeTime.FOREVER; } @@ -145,12 +149,12 @@ public final class RelativeTime implements Comparable { * this=FOREVER, this-other otherwise */ public RelativeTime subtract(final RelativeTime other) { - if (this.rel_value >= other.rel_value) { + if (this.rel_value_us >= other.rel_value_us) { return RelativeTime.ZERO; - } else if (this.rel_value == Long.MAX_VALUE) { + } else if (this.rel_value_us == Long.MAX_VALUE) { return this; } else { - return new RelativeTime(this.rel_value - other.rel_value); + return new RelativeTime(this.rel_value_us - other.rel_value_us); } } @@ -165,24 +169,24 @@ public final class RelativeTime implements Comparable { } public boolean isForever() { - return rel_value == FOREVER.rel_value; + return rel_value_us == FOREVER.rel_value_us; } public boolean equals(Object o) { - return (o instanceof RelativeTime) && ((RelativeTime) o).rel_value == rel_value; + return (o instanceof RelativeTime) && ((RelativeTime) o).rel_value_us == rel_value_us; } @Override public int hashCode() { - return (int) this.rel_value; + return (int) this.rel_value_us; } @Override public int compareTo(RelativeTime other) { - if (this.rel_value < other.rel_value) { + if (this.rel_value_us < other.rel_value_us) { return -1; } - if (this.rel_value > other.rel_value) { + if (this.rel_value_us > other.rel_value_us) { return 1; } return 0; @@ -193,16 +197,16 @@ public final class RelativeTime implements Comparable { if (this.isForever()) { return "RelativeTime(FOREVER)"; } - return "RelativeTime("+this.rel_value+")"; + return "RelativeTime("+this.rel_value_us +")"; } public RelativeTimeMessage toNetwork() { - long rval = this.rel_value; + long rval = this.rel_value_us; assert rval >= 0; - if (rval == FOREVER.rel_value) { + if (rval == FOREVER.rel_value_us) { rval = -1L; /* 0xFFFFFFFFFFFFFFFF for network format! */ } return new RelativeTimeMessage(rval); diff --git a/src/org/gnunet/util/RelativeTimeMessage.java b/src/org/gnunet/util/RelativeTimeMessage.java index 9488441..ac4e66c 100644 --- a/src/org/gnunet/util/RelativeTimeMessage.java +++ b/src/org/gnunet/util/RelativeTimeMessage.java @@ -48,7 +48,7 @@ public class RelativeTimeMessage implements Message { if (t.equals(RelativeTime.FOREVER)) { this.value__ = -1; } else { - this.value__ = t.getMilliseconds(); + this.value__ = t.getMicroseconds(); } } diff --git a/src/org/gnunet/util/Scheduler.java b/src/org/gnunet/util/Scheduler.java index 3680261..6998633 100644 --- a/src/org/gnunet/util/Scheduler.java +++ b/src/org/gnunet/util/Scheduler.java @@ -384,7 +384,7 @@ public class Scheduler { break; } RelativeTime remaining = t.deadline.getRemaining(); - if (remaining.getMilliseconds() <= 0) { + if (remaining.getMicroseconds() <= 0) { t.deregister(); t.ctx.reasons = EnumSet.of(Reason.TIMEOUT); queueReady(t); @@ -408,12 +408,12 @@ public class Scheduler { private static void handleSelect(RelativeTime timeout) { try { // selector.select(0) would block indefinitely (counter-intuitive, java's fault) - if (timeout.getMilliseconds() == 0) { + if (timeout.getMicroseconds() == 0) { selector.selectNow(); } else if (timeout.isForever()) { selector.select(0); } else { - selector.select(timeout.getMilliseconds()); + selector.select(timeout.getMicroseconds()); } } catch (IOException e) { throw new IOError(e); @@ -461,6 +461,7 @@ public class Scheduler { * @param initialTask the initial task to run immediately */ public static void run(Task initialTask) { + logger.info("running scheduler"); if (scheduler_running) { throw new AssertionError("Scheduler already running"); } @@ -468,6 +469,7 @@ public class Scheduler { try { run_unchecked(initialTask); } finally { + logger.info("cleaning up after scheduler ran"); // ensure that after run returns, the scheduler is in its initial state, // even though there was an exception (e.g. after a test case that expects an exception) scheduler_running = false; @@ -495,7 +497,7 @@ public class Scheduler { // the gnunet main loop while (checkLiveness()) { RelativeTime nextTimeout = handleTimeouts(); - if (nextTimeout.getMilliseconds() < 0) { + if (nextTimeout.getMicroseconds() < 0) { logger.warn("negative timeout for select"); } -- cgit v1.2.3