summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-08-11 16:53:48 -0700
committerElliott Hughes <enh@google.com>2010-08-11 16:53:48 -0700
commit7738141c52b931e103efe7ad62d32a12785bf6b1 (patch)
treec74b918fafe85355d378d7b35c9e97d4feb1be05
parent0917c4a9d5d0115950450cdd0bb46e43a48da5db (diff)
downloadlibcore-7738141c52b931e103efe7ad62d32a12785bf6b1.zip
libcore-7738141c52b931e103efe7ad62d32a12785bf6b1.tar.gz
libcore-7738141c52b931e103efe7ad62d32a12785bf6b1.tar.bz2
Remove createServerStreamSocket as a native special case.
We can do everything in Java. Change-Id: I7451319335a647fc25bd2d2403fa98bfc6b5c038
-rw-r--r--dalvik/src/main/java/dalvik/system/BlockGuard.java4
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/net/PlainDatagramSocketImpl.java4
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/net/PlainServerSocketImpl.java10
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java6
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java2
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java2
-rw-r--r--luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp10
7 files changed, 10 insertions, 28 deletions
diff --git a/dalvik/src/main/java/dalvik/system/BlockGuard.java b/dalvik/src/main/java/dalvik/system/BlockGuard.java
index 233c0ee..0cf8a8a 100644
--- a/dalvik/src/main/java/dalvik/system/BlockGuard.java
+++ b/dalvik/src/main/java/dalvik/system/BlockGuard.java
@@ -348,10 +348,6 @@ public final class BlockGuard {
mNetwork.sendUrgentData(fd, value);
}
- public void createServerStreamSocket(FileDescriptor aFD) throws SocketException {
- mNetwork.createServerStreamSocket(aFD);
- }
-
public void createStreamSocket(FileDescriptor aFD) throws SocketException {
mNetwork.createStreamSocket(aFD);
}
diff --git a/luni/src/main/java/org/apache/harmony/luni/net/PlainDatagramSocketImpl.java b/luni/src/main/java/org/apache/harmony/luni/net/PlainDatagramSocketImpl.java
index 742bfc0..ce0a8c6 100644
--- a/luni/src/main/java/org/apache/harmony/luni/net/PlainDatagramSocketImpl.java
+++ b/luni/src/main/java/org/apache/harmony/luni/net/PlainDatagramSocketImpl.java
@@ -53,9 +53,9 @@ public class PlainDatagramSocketImpl extends DatagramSocketImpl {
private volatile boolean isNativeConnected;
- public boolean streaming = true;
+ private boolean streaming = true;
- public boolean shutdownInput;
+ private boolean shutdownInput;
/**
* used to keep address to which the socket was connected to at the native
diff --git a/luni/src/main/java/org/apache/harmony/luni/net/PlainServerSocketImpl.java b/luni/src/main/java/org/apache/harmony/luni/net/PlainServerSocketImpl.java
index a893472..42dd490 100644
--- a/luni/src/main/java/org/apache/harmony/luni/net/PlainServerSocketImpl.java
+++ b/luni/src/main/java/org/apache/harmony/luni/net/PlainServerSocketImpl.java
@@ -18,7 +18,9 @@
package org.apache.harmony.luni.net;
import java.io.FileDescriptor;
+import java.io.IOException;
import java.net.SocketException;
+import java.net.SocketOptions;
import org.apache.harmony.luni.net.PlainSocketImpl;
/**
@@ -34,12 +36,10 @@ public class PlainServerSocketImpl extends PlainSocketImpl {
}
@Override
- protected void create(boolean isStreaming) throws SocketException {
- streaming = isStreaming;
+ protected void create(boolean isStreaming) throws IOException {
+ super.create(isStreaming);
if (isStreaming) {
- netImpl.createServerStreamSocket(fd);
- } else {
- netImpl.createDatagramSocket(fd);
+ setOption(SocketOptions.SO_REUSEADDR, Boolean.TRUE);
}
}
}
diff --git a/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java b/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
index 79d4cd3..5eb241d 100644
--- a/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
+++ b/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java
@@ -51,11 +51,11 @@ public class PlainSocketImpl extends SocketImpl {
protected INetworkSystem netImpl = Platform.getNetworkSystem();
- public boolean streaming = true;
+ private boolean streaming = true;
- public boolean shutdownInput;
+ private boolean shutdownInput;
- Proxy proxy;
+ private Proxy proxy;
public PlainSocketImpl(FileDescriptor fd) {
this.fd = fd;
diff --git a/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java b/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
index 6af1207..152612d 100644
--- a/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
+++ b/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
@@ -69,8 +69,6 @@ public interface INetworkSystem {
public void sendUrgentData(FileDescriptor fd, byte value);
- public void createServerStreamSocket(FileDescriptor fd) throws SocketException;
-
public void createStreamSocket(FileDescriptor fd) throws SocketException;
public void listen(FileDescriptor fd, int backlog) throws SocketException;
diff --git a/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java b/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
index 5f2ad20..d3d58e0 100644
--- a/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
+++ b/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
@@ -52,8 +52,6 @@ final class OSNetworkSystem implements INetworkSystem {
public native void createDatagramSocket(FileDescriptor fd) throws SocketException;
- public native void createServerStreamSocket(FileDescriptor fd) throws SocketException;
-
public native void createStreamSocket(FileDescriptor fd) throws SocketException;
public native void disconnectDatagram(FileDescriptor fd) throws SocketException;
diff --git a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
index 366084b..45a1d00 100644
--- a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
+++ b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp
@@ -608,15 +608,6 @@ static void osNetworkSystem_createStreamSocket(JNIEnv* env, jobject, jobject fil
createSocketFileDescriptor(env, fileDescriptor, SOCK_STREAM);
}
-static void osNetworkSystem_createServerStreamSocket(JNIEnv* env, jobject, jobject fileDescriptor) {
- int fd = createSocketFileDescriptor(env, fileDescriptor, SOCK_STREAM);
- if (fd != -1) {
- // TODO: we could actually do this in Java. (and check for errors!)
- int value = 1;
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(int));
- }
-}
-
static void osNetworkSystem_createDatagramSocket(JNIEnv* env, jobject, jobject fileDescriptor) {
int fd = createSocketFileDescriptor(env, fileDescriptor, SOCK_DGRAM);
#ifdef __linux__
@@ -1533,7 +1524,6 @@ static JNINativeMethod gMethods[] = {
{ "connectNonBlocking", "(Ljava/io/FileDescriptor;Ljava/net/InetAddress;I)Z", (void*) osNetworkSystem_connectNonBlocking },
{ "connect", "(Ljava/io/FileDescriptor;Ljava/net/InetAddress;II)V", (void*) osNetworkSystem_connect },
{ "createDatagramSocket", "(Ljava/io/FileDescriptor;)V", (void*) osNetworkSystem_createDatagramSocket },
- { "createServerStreamSocket", "(Ljava/io/FileDescriptor;)V", (void*) osNetworkSystem_createServerStreamSocket },
{ "createStreamSocket", "(Ljava/io/FileDescriptor;)V", (void*) osNetworkSystem_createStreamSocket },
{ "disconnectDatagram", "(Ljava/io/FileDescriptor;)V", (void*) osNetworkSystem_disconnectDatagram },
{ "getSocketLocalAddress", "(Ljava/io/FileDescriptor;)Ljava/net/InetAddress;", (void*) osNetworkSystem_getSocketLocalAddress },