@@ -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
0 commit comments