Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a02e3c7e authored by Neil Fuller's avatar Neil Fuller Committed by Android Git Automerger
Browse files

am 849558b7: am 26e58f09: am b05c2beb: Merge "Move listen() over to using android.system.Os"

* commit '849558b7':
  Move listen() over to using android.system.Os
parents 808b4440 849558b7
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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();
        }
    }

    /**
+0 −22
Original line number Diff line number Diff line
@@ -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},