Merge "Switch shutdownInput / shutdownOutput to using Os.shutdown."
This commit is contained in:
@@ -201,7 +201,6 @@ class LocalSocketImpl
|
|||||||
int namespace) throws IOException;
|
int namespace) throws IOException;
|
||||||
private native void bindLocal(FileDescriptor fd, String name, int namespace)
|
private native void bindLocal(FileDescriptor fd, String name, int namespace)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
private native void shutdown(FileDescriptor fd, boolean shutdownInput);
|
|
||||||
private native Credentials getPeerCredentials_native(
|
private native Credentials getPeerCredentials_native(
|
||||||
FileDescriptor fd) throws IOException;
|
FileDescriptor fd) throws IOException;
|
||||||
|
|
||||||
@@ -405,7 +404,11 @@ class LocalSocketImpl
|
|||||||
throw new IOException("socket not created");
|
throw new IOException("socket not created");
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown(fd, true);
|
try {
|
||||||
|
Os.shutdown(fd, OsConstants.SHUT_RD);
|
||||||
|
} catch (ErrnoException e) {
|
||||||
|
throw e.rethrowAsIOException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -419,7 +422,11 @@ class LocalSocketImpl
|
|||||||
throw new IOException("socket not created");
|
throw new IOException("socket not created");
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown(fd, false);
|
try {
|
||||||
|
Os.shutdown(fd, OsConstants.SHUT_WR);
|
||||||
|
} catch (ErrnoException e) {
|
||||||
|
throw e.rethrowAsIOException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FileDescriptor getFileDescriptor()
|
protected FileDescriptor getFileDescriptor()
|
||||||
|
|||||||
@@ -112,29 +112,6 @@ socket_bind_local (JNIEnv *env, jobject object, jobject fileDescriptor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private native void shutdown(FileDescriptor fd, boolean shutdownInput) */
|
|
||||||
|
|
||||||
static void
|
|
||||||
socket_shutdown (JNIEnv *env, jobject object, jobject fileDescriptor,
|
|
||||||
jboolean shutdownInput)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
|
|
||||||
|
|
||||||
if (env->ExceptionCheck()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = shutdown(fd, shutdownInput ? SHUT_RD : SHUT_WR);
|
|
||||||
|
|
||||||
if (ret < 0) {
|
|
||||||
jniThrowIOException(env, errno);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes ancillary data, handling only
|
* Processes ancillary data, handling only
|
||||||
* SCM_RIGHTS. Creates appropriate objects and sets appropriate
|
* SCM_RIGHTS. Creates appropriate objects and sets appropriate
|
||||||
@@ -523,7 +500,6 @@ static JNINativeMethod gMethods[] = {
|
|||||||
{"connectLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V",
|
{"connectLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V",
|
||||||
(void*)socket_connect_local},
|
(void*)socket_connect_local},
|
||||||
{"bindLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V", (void*)socket_bind_local},
|
{"bindLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V", (void*)socket_bind_local},
|
||||||
{"shutdown", "(Ljava/io/FileDescriptor;Z)V", (void*)socket_shutdown},
|
|
||||||
{"read_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_read},
|
{"read_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_read},
|
||||||
{"readba_native", "([BIILjava/io/FileDescriptor;)I", (void*) socket_readba},
|
{"readba_native", "([BIILjava/io/FileDescriptor;)I", (void*) socket_readba},
|
||||||
{"writeba_native", "([BIILjava/io/FileDescriptor;)V", (void*) socket_writeba},
|
{"writeba_native", "([BIILjava/io/FileDescriptor;)V", (void*) socket_writeba},
|
||||||
|
|||||||
Reference in New Issue
Block a user