Added ability to enable/disable loading the network native library (if
desired...)
This commit is contained in:
parent
635f97b502
commit
f2a28c2a8d
@ -18,6 +18,7 @@ package dorkbox.network;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
import dorkbox.network.connection.EndPoint;
|
||||||
import dorkbox.util.NativeLoader;
|
import dorkbox.util.NativeLoader;
|
||||||
import dorkbox.util.OS;
|
import dorkbox.util.OS;
|
||||||
import io.netty.channel.epoll.Epoll;
|
import io.netty.channel.epoll.Epoll;
|
||||||
@ -36,7 +37,7 @@ class NativeLibrary {
|
|||||||
* reason, netty will fall back to it's own logic.
|
* reason, netty will fall back to it's own logic.
|
||||||
*/
|
*/
|
||||||
static {
|
static {
|
||||||
if (OS.isLinux() || OS.isMacOsX()) {
|
if (EndPoint.enableNativeLibrary && (OS.isLinux() || OS.isMacOsX())) {
|
||||||
// try to load the native libraries for Linux/MacOsX...
|
// try to load the native libraries for Linux/MacOsX...
|
||||||
String originalLibraryPath = SystemPropertyUtil.get("java.library.path");
|
String originalLibraryPath = SystemPropertyUtil.get("java.library.path");
|
||||||
File outputDirectory;
|
File outputDirectory;
|
||||||
@ -140,5 +141,4 @@ class NativeLibrary {
|
|||||||
// not Linux/MacOsX
|
// not Linux/MacOsX
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,13 @@ class EndPoint extends Shutdownable {
|
|||||||
// TODO: maybe some sort of STUN-like connection keep-alive??
|
// TODO: maybe some sort of STUN-like connection keep-alive??
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines if we are allowed to use the native OS-specific network interface (non-native to java) for boosted networking performance.
|
||||||
|
*/
|
||||||
|
@Property
|
||||||
|
public static boolean enableNativeLibrary = true;
|
||||||
|
|
||||||
|
|
||||||
public static final String LOCAL_CHANNEL = "local_channel";
|
public static final String LOCAL_CHANNEL = "local_channel";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user