summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-03-12 17:21:40 -0800
committerElliott Hughes <enh@google.com>2010-03-12 17:21:40 -0800
commitfdd13e86ec613e46b68376f90d2c89c2ac33b4b5 (patch)
treeaf978a405fb5b9e4557918860c55397d651fab05 /luni
parent36b4e83c292e8f069ea6b0e56b11e317c219b761 (diff)
downloadlibcore-fdd13e86ec613e46b68376f90d2c89c2ac33b4b5.zip
libcore-fdd13e86ec613e46b68376f90d2c89c2ac33b4b5.tar.gz
libcore-fdd13e86ec613e46b68376f90d2c89c2ac33b4b5.tar.bz2
Remove dead obfuscatory code.
Bug: 2509206 Change-Id: I72a34e1f80fd6936d255b94daf5683cc2a0f2327
Diffstat (limited to 'luni')
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/net/PlainDatagramSocketImpl.java64
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java31
-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.java6
-rw-r--r--luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp8
5 files changed, 7 insertions, 104 deletions
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 4d75faf..e2ea82c 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
@@ -75,8 +75,6 @@ public class PlainDatagramSocketImpl extends DatagramSocketImpl {
private byte[] ipaddress = { 0, 0, 0, 0 };
- private int ttl = 1;
-
private INetworkSystem netImpl = Platform.getNetworkSystem();
private volatile boolean isNativeConnected;
@@ -160,41 +158,18 @@ public class PlainDatagramSocketImpl extends DatagramSocketImpl {
} else if (optID == SocketOptions.IP_TOS) {
return Integer.valueOf(trafficClass);
} else {
- // Call the native first so there will be
- // an exception if the socket if closed.
- Object result = netImpl.getSocketOption(fd, optID);
- if (optID == SocketOptions.IP_MULTICAST_IF
- && (netImpl.getSocketFlags() & MULTICAST_IF) != 0) {
- try {
- return InetAddress.getByAddress(ipaddress);
- } catch (UnknownHostException e) {
- return null;
- }
- }
- return result;
+ return netImpl.getSocketOption(fd, optID);
}
}
@Override
public int getTimeToLive() throws IOException {
- // Call the native first so there will be an exception if the socket if
- // closed.
- int result = (((Byte) getOption(IP_MULTICAST_TTL)).byteValue()) & 0xFF;
- if ((netImpl.getSocketFlags() & MULTICAST_TTL) != 0) {
- return ttl;
- }
- return result;
+ return getTTL() & 0xff;
}
@Override
public byte getTTL() throws IOException {
- // Call the native first so there will be an exception if the socket if
- // closed.
- byte result = ((Byte) getOption(IP_MULTICAST_TTL)).byteValue();
- if ((netImpl.getSocketFlags() & MULTICAST_TTL) != 0) {
- return (byte) ttl;
- }
- return result;
+ return ((Byte) getOption(IP_MULTICAST_TTL)).byteValue();
}
@Override
@@ -293,13 +268,11 @@ public class PlainDatagramSocketImpl extends DatagramSocketImpl {
if (optID == SocketOptions.SO_REUSEADDR) {
optID = REUSEADDR_AND_REUSEPORT;
}
-
if (optID == SocketOptions.SO_TIMEOUT) {
receiveTimeout = ((Integer) val).intValue();
} else {
- int flags = netImpl.getSocketFlags();
try {
- netImpl.setSocketOption(fd, optID | (flags << 16), val);
+ netImpl.setSocketOption(fd, optID, val);
} catch (SocketException e) {
// we don't throw an exception for IP_TOS even if the platform
// won't let us set the requested value
@@ -307,24 +280,6 @@ public class PlainDatagramSocketImpl extends DatagramSocketImpl {
throw e;
}
}
- if (optID == SocketOptions.IP_MULTICAST_IF && (flags & MULTICAST_IF) != 0) {
- InetAddress inet = (InetAddress) val;
- if (NetUtil.bytesToInt(inet.getAddress(), 0) == 0 || inet.isLoopbackAddress()) {
- ipaddress = ((InetAddress) val).getAddress();
- } else {
- InetAddress local = null;
- try {
- local = InetAddress.getLocalHost();
- } catch (UnknownHostException e) {
- throw new SocketException("getLocalHost(): " + e.toString());
- }
- if (inet.equals(local)) {
- ipaddress = ((InetAddress) val).getAddress();
- } else {
- throw new SocketException(val + " != getLocalHost(): " + local);
- }
- }
- }
/*
* save this value as it is actually used differently for IPv4 and
* IPv6 so we cannot get the value using the getOption. The option
@@ -341,20 +296,13 @@ public class PlainDatagramSocketImpl extends DatagramSocketImpl {
}
@Override
- public void setTimeToLive(int ttl) throws java.io.IOException {
- // BEGIN android-changed: native code wants an int anyway
+ public void setTimeToLive(int ttl) throws IOException {
setOption(IP_MULTICAST_TTL, Integer.valueOf(ttl));
- // END android-changed
- if ((netImpl.getSocketFlags() & MULTICAST_TTL) != 0) {
- this.ttl = ttl;
- }
}
@Override
- public void setTTL(byte ttl) throws java.io.IOException {
- // BEGIN android-changed: remove duplication
+ public void setTTL(byte ttl) throws IOException {
setTimeToLive(ttl);
- // END android-changed
}
@Override
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 91b0ed0..e6268c2 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
@@ -45,16 +45,6 @@ import org.apache.harmony.luni.util.Msg;
*/
public class PlainSocketImpl extends SocketImpl {
- // Const copy from socket
-
- static final int MULTICAST_IF = 1;
-
- static final int MULTICAST_TTL = 2;
-
- static final int TCP_NODELAY = 4;
-
- static final int FLAG_SHUTDOWN = 8;
-
// For SOCKS support. A SOCKS bind() uses the last
// host connected to in its request.
static private InetAddress lastConnectedAddress;
@@ -65,8 +55,6 @@ public class PlainSocketImpl extends SocketImpl {
private static Field localportField;
- private boolean tcpNoDelay = true;
-
/**
* used to store the trafficClass value which is simply returned as the
* value that was set. We also need it to pass it to methods that specify an
@@ -195,12 +183,6 @@ public class PlainSocketImpl extends SocketImpl {
protected void close() throws IOException {
synchronized (fd) {
if (fd.valid()) {
- if ((netImpl.getSocketFlags() & FLAG_SHUTDOWN) != 0) {
- try {
- shutdownOutput();
- } catch (Exception e) {
- }
- }
netImpl.socketClose(fd);
fd = new FileDescriptor();
}
@@ -289,14 +271,7 @@ public class PlainSocketImpl extends SocketImpl {
} else if (optID == SocketOptions.IP_TOS) {
return Integer.valueOf(trafficClass);
} else {
- // Call the native first so there will be
- // an exception if the socket if closed.
- Object result = netImpl.getSocketOption(fd, optID);
- if (optID == SocketOptions.TCP_NODELAY
- && (netImpl.getSocketFlags() & TCP_NODELAY) != 0) {
- return Boolean.valueOf(tcpNoDelay);
- }
- return result;
+ return netImpl.getSocketOption(fd, optID);
}
}
@@ -325,10 +300,6 @@ public class PlainSocketImpl extends SocketImpl {
} else {
try {
netImpl.setSocketOption(fd, optID, val);
- if (optID == SocketOptions.TCP_NODELAY
- && (netImpl.getSocketFlags() & TCP_NODELAY) != 0) {
- tcpNoDelay = ((Boolean) val).booleanValue();
- }
} catch (SocketException e) {
// we don't throw an exception for IP_TOS even if the platform
// won't let us set the requested value
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 59cb7a4..7ffb30c 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
@@ -234,8 +234,6 @@ public interface INetworkSystem {
public void setSocketOption(FileDescriptor aFD, int opt, Object optVal)
throws SocketException;
- public int getSocketFlags();
-
/*
* Close the socket in the IP stack.
*
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 37bfde9..876ad78 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
@@ -212,18 +212,12 @@ final class OSNetworkSystem implements INetworkSystem {
// static native InetAddress getHostByNameImpl(String addr) throws UnknownHostException;
// END android-removed
- public int getSocketFlags() {
- return getSocketFlagsImpl();
- }
-
public native String byteArrayToIpString(byte[] address)
throws UnknownHostException;
public native byte[] ipStringToByteArray(String address)
throws UnknownHostException;
- static native int getSocketFlagsImpl();
-
public InetAddress getSocketLocalAddress(FileDescriptor fd) {
return getSocketLocalAddressImpl(fd);
}
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 08bdc72..a9b040e 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
@@ -2886,13 +2886,6 @@ static void osNetworkSystem_setSocketOptionImpl(JNIEnv* env, jclass clazz,
}
}
-static jint osNetworkSystem_getSocketFlagsImpl(JNIEnv* env, jclass clazz) {
- // LOGD("ENTER getSocketFlagsImpl");
-
- // Not implemented by harmony
- return 0;
-}
-
static void osNetworkSystem_socketCloseImpl(JNIEnv* env, jclass clazz,
jobject fileDescriptor) {
// LOGD("ENTER socketCloseImpl");
@@ -2951,7 +2944,6 @@ static JNINativeMethod gMethods[] = {
{ "getSocketLocalPortImpl", "(Ljava/io/FileDescriptor;)I", (void*) osNetworkSystem_getSocketLocalPortImpl },
{ "getSocketOptionImpl", "(Ljava/io/FileDescriptor;I)Ljava/lang/Object;", (void*) osNetworkSystem_getSocketOptionImpl },
{ "setSocketOptionImpl", "(Ljava/io/FileDescriptor;ILjava/lang/Object;)V", (void*) osNetworkSystem_setSocketOptionImpl },
- { "getSocketFlagsImpl", "()I", (void*) osNetworkSystem_getSocketFlagsImpl },
{ "socketCloseImpl", "(Ljava/io/FileDescriptor;)V", (void*) osNetworkSystem_socketCloseImpl },
{ "setInetAddressImpl", "(Ljava/net/InetAddress;[B)V", (void*) osNetworkSystem_setInetAddressImpl },
{ "inheritedChannel", "()Ljava/nio/channels/Channel;", (void*) osNetworkSystem_inheritedChannel },