KLALB V3.6.0 写了一半

This commit is contained in:
Administrator
2026-02-27 08:32:03 +08:00
parent 816e672843
commit 620afef715
164 changed files with 8381 additions and 13495 deletions
@@ -4,6 +4,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.*;
import java.nio.channels.SocketChannel;
import java.util.concurrent.locks.LockSupport;
import org.kne.cloud.network.klalb.CannotAssociateException;
import org.kne.cloud.network.klalb.KLALBVirtualSocket;
@@ -33,33 +34,13 @@ public class SocketChannelBridge extends Task{
@Override
protected void runTask() {
try {
if(a instanceof KLALBVirtualSocketChannel) {
try {
((KLALBVirtualSocketChannel) a).associateSocketChannel(b);
}catch(CannotAssociateException e) {
bridgeAB.runAtNewThread("SocketBridge A->B thread");
bridgeBA.runAtNewThread("SocketBridge B->A thread");
bridgeAB.waitfortask();
bridgeBA.waitfortask();
}
}else if(b instanceof KLALBVirtualSocketChannel){
try {
((KLALBVirtualSocketChannel) b).associateSocketChannel(a);
}catch(CannotAssociateException e) {
bridgeAB.runAtNewThread("SocketBridge A->B thread");
bridgeBA.runAtNewThread("SocketBridge B->A thread");
bridgeAB.waitfortask();
bridgeBA.waitfortask();
}
}else {
bridgeAB.runAtNewThread("SocketBridge A->B thread");
bridgeBA.runAtNewThread("SocketBridge B->A thread");
bridgeAB.waitfortask();
bridgeBA.waitfortask();
}
Thread ta=bridgeAB.runAtNewThread("SocketBridge A->B thread");
Thread tb=bridgeBA.runAtNewThread("SocketBridge B->A thread");
while((ta.isAlive()||tb.isAlive())&&a.isOpen()&&b.isOpen()) {
LockSupport.parkNanos(1000000L);
}
} catch (Exception e) {
e.printStackTrace();
}finally {