Skip to content

Commit 92982d7

Browse files
committed
Improvements to logging
1 parent 211dc73 commit 92982d7

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

convex-core/src/main/java/convex/core/util/Shutdown.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class Shutdown {
2525
public void run() {
2626
Shutdown.runHooks();
2727
}
28-
}));
28+
},"Convex Shutdown"));
2929
} catch(IllegalStateException e) {
3030
// Ignore, already shutting down
3131
}

convex-peer/src/main/java/convex/peer/ConnectionManager.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,10 @@ public synchronized void broadcast(Message msg) throws InterruptedException {
534534
long start=Utils.getCurrentTimestamp();
535535
while ((!hm.isEmpty())&&(start+BROADCAST_TIMEOUT>Utils.getCurrentTimestamp())) {
536536
ArrayList<Map.Entry<AccountKey,Connection>> left=new ArrayList<>(hm.entrySet());
537+
538+
// Shuffle order for sending
537539
Utils.shuffle(left);
540+
538541
for (Map.Entry<AccountKey,Connection> me: left) {
539542
Connection pc=me.getValue();
540543
try {
@@ -545,10 +548,11 @@ public synchronized void broadcast(Message msg) throws InterruptedException {
545548
// log.warn("Delayed sending to peer because of full Buffer");
546549
}
547550
} catch (ClosedChannelException e) {
548-
log.debug("Closed channel during broadcast");
551+
log.trace("Closed channel during broadcast");
549552
pc.close();
550553
} catch (IOException e) {
551-
log.warn("IO Error in broadcast: ", e);
554+
// probably the connection was forcibly closed
555+
log.debug("Closed channel during broadcast",e);
552556
pc.close();
553557
}
554558
}
@@ -608,6 +612,7 @@ public Connection connectToPeer(InetSocketAddress hostAddress) {
608612
}
609613
} catch (IOException | TimeoutException e) {
610614
// ignore any errors from the peer connections
615+
return null;
611616
} catch (UnresolvedAddressException e) {
612617
log.info("Unable to resolve host address: "+hostAddress);
613618
}
@@ -668,8 +673,10 @@ public void alertBadMessage(Message m, String message) {
668673
* @param key
669674
*/
670675
public void alertMissing(Message m, MissingDataException e, AccountKey key) {
671-
String message= "Missing data "+e.getMissingHash()+" from "+m.getOriginString();
672-
log.warn(message);
676+
if (log.isDebugEnabled()) {
677+
String message= "Missing data "+e.getMissingHash()+" from "+m.getOriginString();
678+
log.debug(message);
679+
}
673680

674681
// TODO: possibly fire off request to specific Peer? Unclear if this improves things generally, but might avoid polling
675682

convex-peer/src/main/java/convex/peer/Server.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ private void establishController() {
185185
}
186186
AccountStatus as=peer.getConsensusState().getAccount(controlAddress);
187187
if (as==null) {
188-
log.warn("Peer Controller Account does not exist: "+controlAddress);
189-
} else if (!as.getAccountKey().equals(getKeyPair().getAccountKey())) {
188+
log.warn("Peer Controller Account does not currently exist (perhaps pending sync?): "+controlAddress);
189+
} else if (!Utils.equals(as.getAccountKey(),getKeyPair().getAccountKey())) {
190190
// TODO: not a problem?
191191
log.warn("Server keypair does not match keypair for control account: "+controlAddress);
192192
}

0 commit comments

Comments
 (0)