Minor improvements and fixes

This commit is contained in:
2016-09-05 19:35:36 +02:00
parent dad05d835b
commit a240606909
5 changed files with 27 additions and 17 deletions

View File

@ -145,7 +145,7 @@ public abstract class AbstractConnection {
updateIvCache(inv.getInventory());
List<InventoryVector> missing = ctx.getInventory().getMissing(inv.getInventory(), streams);
missing.removeAll(commonRequestedObjects);
LOG.debug("Received inventory with " + originalSize + " elements, of which are "
LOG.trace("Received inventory with " + originalSize + " elements, of which are "
+ missing.size() + " missing.");
send(new GetData.Builder().inventory(missing).build());
}

View File

@ -135,6 +135,7 @@ public class ConnectionInfo extends AbstractConnection {
reader.cleanup();
reader = null;
}
payloadOut = null;
}
public boolean isSyncFinished() {

View File

@ -239,8 +239,8 @@ public class NioNetworkHandler implements NetworkHandler, InternalContext.Contex
}
e.getValue().cancel();
e.getValue().attach(null);
it.remove();
e.getKey().disconnect();
it.remove();
}
}
try {
@ -387,12 +387,20 @@ public class NioNetworkHandler implements NetworkHandler, InternalContext.Contex
distribution.put(connection, new LinkedList<InventoryVector>());
}
}
if (distribution.isEmpty()){
return;
}
InventoryVector next = iterator.next();
ConnectionInfo previous = null;
do {
for (ConnectionInfo connection : distribution.keySet()) {
if (connection == previous || previous == null) {
next = iterator.next();
if (iterator.hasNext()) {
previous = connection;
next = iterator.next();
} else {
break;
}
}
if (connection.knowsOf(next)) {
List<InventoryVector> ivs = distribution.get(connection);