Take the architecture into account when loading netty-tcnative
Motivation: We should ensure we only try to load the netty-tcnative version that was compiled for the architecture we are using. Modifications: Include architecture into native lib name. Result: Only load native lib if the architecture is supported.
This commit is contained in:
parent
cdb2a27857
commit
ad1f0d46b3
@ -406,15 +406,17 @@ public final class OpenSsl {
|
|||||||
String arch = PlatformDependent.normalizedArch();
|
String arch = PlatformDependent.normalizedArch();
|
||||||
|
|
||||||
Set<String> libNames = new LinkedHashSet<String>(4);
|
Set<String> libNames = new LinkedHashSet<String>(4);
|
||||||
|
String staticLibName = "netty_tcnative";
|
||||||
|
|
||||||
// First, try loading the platform-specific library. Platform-specific
|
// First, try loading the platform-specific library. Platform-specific
|
||||||
// libraries will be available if using a tcnative uber jar.
|
// libraries will be available if using a tcnative uber jar.
|
||||||
libNames.add("netty_tcnative_" + os + '_' + arch);
|
libNames.add(staticLibName + "_" + os + '_' + arch);
|
||||||
if ("linux".equalsIgnoreCase(os)) {
|
if ("linux".equalsIgnoreCase(os)) {
|
||||||
// Fedora SSL lib so naming (libssl.so.10 vs libssl.so.1.0.0)..
|
// Fedora SSL lib so naming (libssl.so.10 vs libssl.so.1.0.0)..
|
||||||
libNames.add("netty_tcnative_" + os + '_' + arch + "_fedora");
|
libNames.add(staticLibName + "_" + os + '_' + arch + "_fedora");
|
||||||
}
|
}
|
||||||
// finally the default library.
|
libNames.add(staticLibName + "_" + arch);
|
||||||
libNames.add("netty_tcnative");
|
libNames.add(staticLibName);
|
||||||
|
|
||||||
NativeLibraryLoader.loadFirstAvailable(SSL.class.getClassLoader(),
|
NativeLibraryLoader.loadFirstAvailable(SSL.class.getClassLoader(),
|
||||||
libNames.toArray(new String[libNames.size()]));
|
libNames.toArray(new String[libNames.size()]));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user