Enable Netty on a big endian platform

Motivation:

We would like to enable Netty also on a big endian platform such as
s390_64. We need to fix a function which assumes that the target
platform is little endian.

Modifications:

Modify netty_unix_socket_accept() to write an address length as jbyte
instead of jsize.

Result:

Netty can be enabled on a big endian platform.

Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
This commit is contained in:
Tatsushi Inagaki 2019-09-26 07:57:47 +00:00 committed by Norman Maurer
parent e1317db328
commit 3fbec92221

View File

@ -540,6 +540,7 @@ static jint netty_unix_socket_disconnect(JNIEnv* env, jclass clazz, jint fd, jbo
static jint netty_unix_socket_accept(JNIEnv* env, jclass clazz, jint fd, jbyteArray acceptedAddress) {
jint socketFd;
jsize len;
jbyte len_b;
int err;
struct sockaddr_storage addr;
socklen_t address_len = sizeof(addr);
@ -564,9 +565,10 @@ static jint netty_unix_socket_accept(JNIEnv* env, jclass clazz, jint fd, jbyteAr
}
len = addressLength(&addr);
len_b = (jbyte) len;
// Fill in remote address details
(*env)->SetByteArrayRegion(env, acceptedAddress, 0, 4, (jbyte*) &len);
(*env)->SetByteArrayRegion(env, acceptedAddress, 0, 1, (jbyte*) &len_b);
initInetSocketAddressArray(env, &addr, acceptedAddress, 1, len);
if (accept4) {