Compare commits

..

No commits in common. "886cd1d32163fba54ff3a758f79b6c2542bd987c" and "6587eac413e1c252eb7d4da5f7acab6cb8dd39b4" have entirely different histories.

2 changed files with 20 additions and 32 deletions

View File

@ -1,5 +1,5 @@
Manifest-Version: 1.0 Manifest-Version: 1.0
Main-Class: com.captainalm.test.calmnet.Main Main-Class: com.captainalm.test.calmnet.Main
Class-Path: calmnetlib-0.1.0.jar calmnetlib-0.0.1.jar calmstdcrypt-0.0.1 Class-Path: calmnetlib-0.0.1.jar calmstdcrypt-0.0.1.jar calmnetlib.jar c
.jar calmnetlib.jar calmstdcrypt.jar almstdcrypt.jar

View File

@ -8,7 +8,6 @@ import com.captainalm.lib.calmnet.ssl.*;
import com.captainalm.lib.calmnet.packet.IPacket; import com.captainalm.lib.calmnet.packet.IPacket;
import com.captainalm.lib.calmnet.packet.PacketException; import com.captainalm.lib.calmnet.packet.PacketException;
import com.captainalm.lib.calmnet.packet.core.NetworkSSLUpgradePacket; import com.captainalm.lib.calmnet.packet.core.NetworkSSLUpgradePacket;
import com.captainalm.lib.stdcrypt.digest.DigestProvider;
import com.captainalm.utils.Console; import com.captainalm.utils.Console;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
@ -112,14 +111,6 @@ public final class Main {
port = 0; port = 0;
Console.writeLine("Ignored! ; Setting To: 0"); Console.writeLine("Ignored! ; Setting To: 0");
} }
Console.writeLine("Use hash trailer (Y/OTHER):");
char hopt = Console.readCharacter();
if ((hopt == 'Y' || hopt == 'y') && factory.getPacketLoader().getHashProvider() == null) {
factory.setPacketLoader(new PacketLoader(DigestProvider.getSHA256Instance(true)));
} else if (factory.getPacketLoader().getHashProvider() != null){
factory.setPacketLoader(new PacketLoader());
}
Console.writeLine("Use Fragmentation (Y/OTHER):"); Console.writeLine("Use Fragmentation (Y/OTHER):");
char fopt = Console.readCharacter(); char fopt = Console.readCharacter();
@ -195,7 +186,7 @@ public final class Main {
DatagramSocket socket = new DatagramSocket(); DatagramSocket socket = new DatagramSocket();
client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts); client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
isClient = true; isClient = true;
} catch (IOException | NullPointerException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
break; break;
@ -206,7 +197,7 @@ public final class Main {
if (!socket.getLoopbackMode()) socket.setLoopbackMode(true); if (!socket.getLoopbackMode()) socket.setLoopbackMode(true);
client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts); client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
isClient = false; isClient = false;
} catch (IOException | NullPointerException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
break; break;
@ -216,7 +207,7 @@ public final class Main {
DatagramSocket socket = new DatagramSocket(port, address); DatagramSocket socket = new DatagramSocket(port, address);
client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts); client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
isClient = true; isClient = true;
} catch (IOException | NullPointerException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
break; break;
@ -227,7 +218,7 @@ public final class Main {
if (socket.getLoopbackMode()) socket.setLoopbackMode(false); if (socket.getLoopbackMode()) socket.setLoopbackMode(false);
client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts); client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
isClient = false; isClient = false;
} catch (IOException | NullPointerException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
break; break;
@ -298,7 +289,6 @@ public final class Main {
if (!packet.isValid()) continue; if (!packet.isValid()) continue;
if (packet instanceof AKNPacket) { if (packet instanceof AKNPacket) {
synchronized (slockAckned) { synchronized (slockAckned) {
//System.out.println(Thread.currentThread().getName() + " : AKN");
ackn = true; ackn = true;
slockAckned.notifyAll(); slockAckned.notifyAll();
} }
@ -429,8 +419,6 @@ public final class Main {
private static void doAKNWait(IPacket packet) { private static void doAKNWait(IPacket packet) {
ackn = false; ackn = false;
int i = 0; int i = 0;
try {
synchronized (slockAckned) {
while (++i <= sendLoopsRemainingSetting && !ackn) { while (++i <= sendLoopsRemainingSetting && !ackn) {
try { try {
if (server != null) { if (server != null) {
@ -442,14 +430,14 @@ public final class Main {
} catch (IOException | PacketException e) { } catch (IOException | PacketException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (ackn) break; try {
//System.out.println(Thread.currentThread().getName() + " : " + (i - 1)); synchronized (slockAckned) {
slockAckned.wait(sendLoopWaitTime); slockAckned.wait(sendLoopWaitTime);
} }
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }
} }
}
private static void message() { private static void message() {
if ((server == null || !server.isRunning()) && (client == null || !client.isRunning())) return; if ((server == null || !server.isRunning()) && (client == null || !client.isRunning())) return;