forked from KNEMC/KLALB
稳定性升级
This commit is contained in:
@@ -264,15 +264,21 @@ public class KLALBController {
|
||||
if (l == null || l.isEmpty()) {
|
||||
throw new NoRouteToHostException("address unreachable: " + addr);
|
||||
}
|
||||
int count0 = Math.min(count, l.size());
|
||||
List<KLALBRemoteSocket> l2 = (List<KLALBRemoteSocket>) ((ArrayList<KLALBRemoteSocket>) l).clone();
|
||||
LineDecitionComparator ldc = new LineDecitionComparator(l2, priority);
|
||||
l2.removeAll(packet.getSendRecord());
|
||||
if(l2.isEmpty()) {
|
||||
l2 = (List<KLALBRemoteSocket>) ((ArrayList<KLALBRemoteSocket>) l).clone();
|
||||
}
|
||||
int count0 = Math.min(count, l2.size());
|
||||
LineDecitionComparator ldc = new LineDecitionComparator(l2,packet, priority);
|
||||
Collections.sort(l2,ldc);
|
||||
//System.out.println(l2);
|
||||
for (Iterator<KLALBRemoteSocket> iterator = l2.iterator(); iterator.hasNext();) {
|
||||
KLALBRemoteSocket krst = (KLALBRemoteSocket) iterator.next();
|
||||
krst.sendPacket(packet, priority);
|
||||
packet.getSendRecord().add(krst);
|
||||
count0--;
|
||||
Thread.yield();
|
||||
if (count0 <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user