Compare commits
2 Commits
6587eac413
...
886cd1d321
Author | SHA1 | Date | |
---|---|---|---|
886cd1d321 | |||
a99c3fba70 |
@ -1,5 +1,5 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: com.captainalm.test.calmnet.Main
|
||||
Class-Path: calmnetlib-0.0.1.jar calmstdcrypt-0.0.1.jar calmnetlib.jar c
|
||||
almstdcrypt.jar
|
||||
Class-Path: calmnetlib-0.1.0.jar calmnetlib-0.0.1.jar calmstdcrypt-0.0.1
|
||||
.jar calmnetlib.jar calmstdcrypt.jar
|
||||
|
||||
|
@ -8,6 +8,7 @@ import com.captainalm.lib.calmnet.ssl.*;
|
||||
import com.captainalm.lib.calmnet.packet.IPacket;
|
||||
import com.captainalm.lib.calmnet.packet.PacketException;
|
||||
import com.captainalm.lib.calmnet.packet.core.NetworkSSLUpgradePacket;
|
||||
import com.captainalm.lib.stdcrypt.digest.DigestProvider;
|
||||
import com.captainalm.utils.Console;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
@ -111,6 +112,14 @@ public final class Main {
|
||||
port = 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):");
|
||||
char fopt = Console.readCharacter();
|
||||
|
||||
@ -186,7 +195,7 @@ public final class Main {
|
||||
DatagramSocket socket = new DatagramSocket();
|
||||
client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
|
||||
isClient = true;
|
||||
} catch (IOException e) {
|
||||
} catch (IOException | NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
@ -197,7 +206,7 @@ public final class Main {
|
||||
if (!socket.getLoopbackMode()) socket.setLoopbackMode(true);
|
||||
client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
|
||||
isClient = false;
|
||||
} catch (IOException e) {
|
||||
} catch (IOException | NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
@ -207,7 +216,7 @@ public final class Main {
|
||||
DatagramSocket socket = new DatagramSocket(port, address);
|
||||
client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
|
||||
isClient = true;
|
||||
} catch (IOException e) {
|
||||
} catch (IOException | NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
@ -218,7 +227,7 @@ public final class Main {
|
||||
if (socket.getLoopbackMode()) socket.setLoopbackMode(false);
|
||||
client = new NetMarshalClient(socket, address, port, factory, factory.getPacketLoader(), fragOpts);
|
||||
isClient = false;
|
||||
} catch (IOException e) {
|
||||
} catch (IOException | NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
@ -289,6 +298,7 @@ public final class Main {
|
||||
if (!packet.isValid()) continue;
|
||||
if (packet instanceof AKNPacket) {
|
||||
synchronized (slockAckned) {
|
||||
//System.out.println(Thread.currentThread().getName() + " : AKN");
|
||||
ackn = true;
|
||||
slockAckned.notifyAll();
|
||||
}
|
||||
@ -419,6 +429,8 @@ public final class Main {
|
||||
private static void doAKNWait(IPacket packet) {
|
||||
ackn = false;
|
||||
int i = 0;
|
||||
try {
|
||||
synchronized (slockAckned) {
|
||||
while (++i <= sendLoopsRemainingSetting && !ackn) {
|
||||
try {
|
||||
if (server != null) {
|
||||
@ -430,12 +442,12 @@ public final class Main {
|
||||
} catch (IOException | PacketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
synchronized (slockAckned) {
|
||||
if (ackn) break;
|
||||
//System.out.println(Thread.currentThread().getName() + " : " + (i - 1));
|
||||
slockAckned.wait(sendLoopWaitTime);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user