am b05c2beb: Merge "Move listen() over to using android.system.Os"
* commit 'b05c2bebf85619aaedaa39593acc53eaaed22493': Move listen() over to using android.system.Os
This commit is contained in:
@@ -201,8 +201,6 @@ class LocalSocketImpl
|
||||
int namespace) throws IOException;
|
||||
private native void bindLocal(FileDescriptor fd, String name, int namespace)
|
||||
throws IOException;
|
||||
private native void listen_native(FileDescriptor fd, int backlog)
|
||||
throws IOException;
|
||||
private native void shutdown(FileDescriptor fd, boolean shutdownInput);
|
||||
private native Credentials getPeerCredentials_native(
|
||||
FileDescriptor fd) throws IOException;
|
||||
@@ -326,8 +324,11 @@ class LocalSocketImpl
|
||||
if (fd == null) {
|
||||
throw new IOException("socket not created");
|
||||
}
|
||||
|
||||
listen_native(fd, backlog);
|
||||
try {
|
||||
Os.listen(fd, backlog);
|
||||
} catch (ErrnoException e) {
|
||||
throw e.rethrowAsIOException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,27 +112,6 @@ socket_bind_local (JNIEnv *env, jobject object, jobject fileDescriptor,
|
||||
}
|
||||
}
|
||||
|
||||
/* private native void listen_native(int fd, int backlog) throws IOException; */
|
||||
static void
|
||||
socket_listen (JNIEnv *env, jobject object, jobject fileDescriptor, jint backlog)
|
||||
{
|
||||
int ret;
|
||||
int fd;
|
||||
|
||||
fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
|
||||
|
||||
if (env->ExceptionCheck()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = listen(fd, backlog);
|
||||
|
||||
if (ret < 0) {
|
||||
jniThrowIOException(env, errno);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* private native FileDescriptor
|
||||
** accept (FileDescriptor fd, LocalSocketImpl s)
|
||||
** throws IOException;
|
||||
@@ -587,7 +566,6 @@ static JNINativeMethod gMethods[] = {
|
||||
{"connectLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V",
|
||||
(void*)socket_connect_local},
|
||||
{"bindLocal", "(Ljava/io/FileDescriptor;Ljava/lang/String;I)V", (void*)socket_bind_local},
|
||||
{"listen_native", "(Ljava/io/FileDescriptor;I)V", (void*)socket_listen},
|
||||
{"accept", "(Ljava/io/FileDescriptor;Landroid/net/LocalSocketImpl;)Ljava/io/FileDescriptor;", (void*)socket_accept},
|
||||
{"shutdown", "(Ljava/io/FileDescriptor;Z)V", (void*)socket_shutdown},
|
||||
{"read_native", "(Ljava/io/FileDescriptor;)I", (void*) socket_read},
|
||||
|
||||
Reference in New Issue
Block a user