You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2008/11/22 21:48:45 UTC

svn commit: r719916 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main: java/org/apache/harmony/luni/platform/OSNetworkSystem.java native/luni/shared/OSNetworkSystem.c native/luni/shared/OSNetworkSystem.h native/luni/unix/exports.txt

Author: tellison
Date: Sat Nov 22 12:48:45 2008
New Revision: 719916

URL: http://svn.apache.org/viewvc?rev=719916&view=rev
Log:
More tidy-up in OSNetworkSystem.  Method renaming and consolidation.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java?rev=719916&r1=719915&r2=719916&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java Sat Nov 22 12:48:45 2008
@@ -37,7 +37,7 @@
 
     private static boolean isNetworkInited = false;
 
-    private static OSNetworkSystem ref = new OSNetworkSystem();
+    private static OSNetworkSystem singleton = new OSNetworkSystem();
 
     // Can not be instantiated.
     private OSNetworkSystem() {
@@ -50,7 +50,7 @@
      * @return the network system interface instance
      */
     public static OSNetworkSystem getOSNetworkSystem() {
-        return ref;
+        return singleton;
     }
 
     public native void createSocket(FileDescriptor fd, boolean preferIPv4Stack)
@@ -180,19 +180,36 @@
             long address, int offset, int length, int receiveTimeout,
             boolean peek) throws IOException;
 
-    public int recvConnectedDatagram(FileDescriptor aFD, DatagramPacket packet,
-            byte[] data, int offset, int length, int receiveTimeout,
-            boolean peek) throws IOException {
-        return recvConnectedDatagramImpl(aFD, packet, data, offset, length,
-                receiveTimeout, peek);
-    }
+    /**
+     * Recieve data on the connected socket into the specified buffer. The
+     * packet fields <code>data</code> and <code>length</code> are passed in
+     * addition to <code>packet</code> to eliminate the JNI field access calls.
+     * 
+     * @param fd
+     *            the socket FileDescriptor
+     * @param packet
+     *            the DatagramPacket to receive into
+     * @param data
+     *            the data buffer of the packet
+     * @param offset
+     *            the offset in the data buffer
+     * @param length
+     *            the length of the data buffer in the packet
+     * @param receiveTimeout
+     *            the maximum length of time the socket should block, reading
+     * @param peek
+     *            indicates to peek at the data
+     * @return number of data received
+     * @exception IOException
+     *                upon an read error or timeout
+     */
+    public native int recvConnectedDatagram(FileDescriptor fd,
+            DatagramPacket packet, byte[] data, int offset, int length,
+            int receiveTimeout, boolean peek) throws IOException;
 
-    public int recvConnectedDatagramDirect(FileDescriptor aFD,
+    public native int recvConnectedDatagramDirect(FileDescriptor fd,
             DatagramPacket packet, long address, int offset, int length,
-            int receiveTimeout, boolean peek) throws IOException {
-        return recvConnectedDatagramDirectImpl(aFD, packet, address, offset,
-                length, receiveTimeout, peek);
-    }
+            int receiveTimeout, boolean peek) throws IOException;
 
     /**
      * Peek on the socket, update <code>sender</code> address and answer the
@@ -212,16 +229,30 @@
     public native int peekDatagram(FileDescriptor fd, InetAddress sender,
             int receiveTimeout) throws IOException;
 
-    public int sendConnectedDatagram(FileDescriptor fd, byte[] data,
-            int offset, int length, boolean bindToDevice) throws IOException {
-        return sendConnectedDatagramImpl(fd, data, offset, length, bindToDevice);
-    }
+    /**
+     * Send the <code>data</code> to the address and port to which the was
+     * connected and <code>port</code>.
+     * 
+     * @param fd
+     *            the socket FileDescriptor
+     * @param data
+     *            the data buffer of the packet
+     * @param offset
+     *            the offset in the data buffer
+     * @param length
+     *            the length of the data buffer in the packet
+     * @param bindToDevice
+     *            not used, current kept in case needed as was the case for
+     *            sendDatagramImpl
+     * @return number of data send
+     * @throws IOException
+     *             upon an read error or timeout
+     */
+    public native int sendConnectedDatagram(FileDescriptor fd, byte[] data,
+            int offset, int length, boolean bindToDevice) throws IOException;
 
-    public int sendConnectedDatagramDirect(FileDescriptor fd, long address,
-            int offset, int length, boolean bindToDevice) throws IOException {
-        return sendConnectedDatagramDirectImpl(fd, address, offset, length,
-                bindToDevice);
-    }
+    public native int sendConnectedDatagramDirect(FileDescriptor fd, long address,
+            int offset, int length, boolean bindToDevice) throws IOException;
 
     /**
      * Disconnect the socket to a port and address
@@ -283,32 +314,37 @@
     public native int receiveStream(FileDescriptor aFD, byte[] data, int offset,
             int count, int timeout) throws IOException;
 
-    public int sendStream(FileDescriptor fd, byte[] data, int offset, int count)
-            throws IOException {
-        return sendStreamImpl(fd, data, offset, count);
-    }
+    /**
+     * Send <code>count</code> bytes from the buffer <code>data</code> at the
+     * <code>offset</code>, on the socket.
+     * 
+     * @param fd
+     * 
+     * @param data
+     *            the send buffer @param offset the offset into the buffer
+     * @param count
+     *            the number of bytes to receive
+     * @return the actual number of bytes sent
+     * @throws IOException
+     * @throws SocketException
+     *             if an error occurs while writing
+     */
+    public native int sendStream(FileDescriptor fd, byte[] data, int offset,
+            int count) throws IOException;
 
-    public void shutdownInput(FileDescriptor descriptor) throws IOException {
-        shutdownInputImpl(descriptor);
-    }
+    public native void shutdownInput(FileDescriptor fd) throws IOException;
 
-    public void shutdownOutput(FileDescriptor descriptor) throws IOException {
-        shutdownOutputImpl(descriptor);
-    }
+    public native void shutdownOutput(FileDescriptor fd) throws IOException;
 
     public native boolean supportsUrgentData(FileDescriptor fd);
 
-    public void sendUrgentData(FileDescriptor fd, byte value) {
-        sendUrgentDataImpl(fd, value);
-    }
+    public native void sendUrgentData(FileDescriptor fd, byte value);
 
     public native int availableStream(FileDescriptor fd) throws SocketException;
 
-    public void acceptStreamSocket(FileDescriptor fdServer,
+    public native void acceptStreamSocket(FileDescriptor fdServer,
             SocketImpl newSocket, FileDescriptor fdnewSocket, int timeout)
-            throws IOException {
-        acceptStreamSocketImpl(fdServer, newSocket, fdnewSocket, timeout);
-    }
+            throws IOException;
 
     public native void createStreamSocket(FileDescriptor fd, boolean preferIPv4Stack)
             throws SocketException;
@@ -437,10 +473,10 @@
     /**
      * Close the socket in the IP stack.
      * 
-     * @param aFD
+     * @param fd
      *            the socket descriptor
      */
-    public native void socketClose(FileDescriptor aFD) throws IOException;
+    public native void socketClose(FileDescriptor fd) throws IOException;
 
     public native InetAddress getHostByAddr(byte[] addr) throws UnknownHostException;
 
@@ -449,8 +485,6 @@
 
     public native void setInetAddress(InetAddress sender, byte[] address);
 
-    static native void sendUrgentDataImpl(FileDescriptor fd, byte value);
-
     /**
      * Connect the socket to a port and address
      * 
@@ -468,90 +502,11 @@
     static native void connectDatagramImpl2(FileDescriptor aFD, int port,
             int trafficClass, InetAddress inetAddress) throws SocketException;
 
-    /**
-     * Allocate a datagram socket in the IP stack. The socket is associated with
-     * the <code>aFD</code>.
-     * 
-     * @param aFD
-     *            the FileDescriptor to associate with the socket @param
-     *            preferIPv4Stack IP stack preference if underlying platform is
-     *            V4/V6
-     * @exception SocketException
-     *                upon an allocation error
-     */
-
-    /**
-     * Recieve data on the connected socket into the specified buffer. The
-     * packet fields <code>data</code> & <code>length</code> are passed in
-     * addition to <code>packet</code> to eliminate the JNI field access calls.
-     * 
-     * @param aFD
-     *            the socket FileDescriptor @param packet the DatagramPacket to
-     *            receive into @param data the data buffer of the packet @param
-     *            offset the offset in the data buffer @param length the length
-     *            of the data buffer in the packet @param receiveTimeout the
-     *            maximum length of time the socket should block, reading @param
-     *            peek indicates to peek at the data @return number of data
-     *            received @exception IOException upon an read error or timeout
-     */
-    static native int recvConnectedDatagramImpl(FileDescriptor aFD,
-            DatagramPacket packet, byte[] data, int offset, int length,
-            int receiveTimeout, boolean peek) throws IOException;
-
-    static native int recvConnectedDatagramDirectImpl(FileDescriptor aFD,
-            DatagramPacket packet, long address, int offset, int length,
-            int receiveTimeout, boolean peek) throws IOException;
-
-    /**
-     * Send the <code>data</code> to the address and port to which the was
-     * connnected and <code>port</code>.
-     * 
-     * @param fd
-     *            the socket FileDescriptor @param data the data buffer of the
-     *            packet @param offset the offset in the data buffer @param
-     *            length the length of the data buffer in the packet @param
-     *            bindToDevice not used, current kept in case needed as was the
-     *            case for sendDatagramImpl @return number of data send @exception
-     *            IOException upon an read error or timeout
-     */
-    static native int sendConnectedDatagramImpl(FileDescriptor fd, byte[] data,
-            int offset, int length, boolean bindToDevice) throws IOException;
-
-    static native int sendConnectedDatagramDirectImpl(FileDescriptor fd,
-            long address, int offset, int length, boolean bindToDevice)
-            throws IOException;
-
-    /**
-     * Send <code>count</code> bytes from the buffer <code>data</code> at the
-     * <code>offset</code>, on the socket.
-     * 
-     * @param fd
-     * 
-     * @param data
-     *            the send buffer @param offset the offset into the buffer
-     * @param count
-     *            the number of bytes to receive @return int the actual number
-     *            of bytes sent @throws IOException @exception SocketException
-     *            if an error occurs while writing
-     */
-    static native int sendStreamImpl(FileDescriptor fd, byte[] data,
-            int offset, int count) throws IOException;
-
-    private native void shutdownInputImpl(FileDescriptor descriptor)
-            throws IOException;
-
-    private native void shutdownOutputImpl(FileDescriptor descriptor)
-            throws IOException;
-
-    static native void acceptStreamSocketImpl(FileDescriptor fdServer,
-            SocketImpl newSocket, FileDescriptor fdnewSocket, int timeout)
-            throws IOException;
-
-    static native int selectImpl(FileDescriptor[] readfd,
+    private static native int selectImpl(FileDescriptor[] readfd,
             FileDescriptor[] writefd, int cread, int cwirte, int[] flags,
             long timeout);
 
-    native int isReachableByICMPImpl(InetAddress addr, InetAddress local,
+    private native int isReachableByICMPImpl(InetAddress addr, InetAddress local,
             int ttl, int timeout);
 
     public native Channel inheritedChannel();
@@ -563,5 +518,5 @@
         }
     }
 
-    native void oneTimeInitializationImpl(boolean jcl_supports_ipv6);
+    private native void oneTimeInitializationImpl(boolean jcl_supports_ipv6);
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=719916&r1=719915&r2=719916&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c Sat Nov 22 12:48:45 2008
@@ -803,12 +803,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    sendUrgentDataImpl
+ * Method:    sendUrgentData
  * Signature: (Ljava/io/FileDescriptor;B)Z
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentDataImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyte data)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentData
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyte data)
 {
   PORT_ACCESS_FROM_ENV(env);
   hysocket_t socketP;
@@ -1124,12 +1124,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    recvConnectedDatagramImpl
+ * Method:    recvConnectedDatagram
  * Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;[BIIIZ)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagram
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor,
    jobject datagramPacket, jbyteArray data, jint offset, jint msgLength,
    jint timeout, jboolean peek)
 {
@@ -1147,8 +1147,8 @@
   }
 
   result =
-    Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirectImpl
-    (env, thisClz, fileDescriptor, datagramPacket, (jlong)(IDATA)message, offset,
+    Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirect
+    (env, thiz, fileDescriptor, datagramPacket, (jlong)(IDATA)message, offset,
      localCount, timeout, peek);
 
   if (result > 0) {
@@ -1162,12 +1162,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    recvConnectedDatagramDirectImpl
+ * Method:    recvConnectedDatagramDirect
  * Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;JIIIZ)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirectImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirect
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor,
    jobject datagramPacket, jlong address, jint offset, jint msgLength,
    jint timeout, jboolean peek)
 {
@@ -1210,22 +1210,23 @@
         || (HYPORT_ERROR_SOCKET_CONNECTION_REFUSED == result)) {
       throwJavaNetPortUnreachableException(env, result);
       return (jint) 0;
-    } else {
-      throwJavaNetSocketException(env, result);
-      return (jint) 0;
     }
-  } else {
-    /* update  the packet with the length of data received.
-       Since we are connected  we did not get back an address.  This
-       address is cached within the PlainDatagramSocket  java  object and is filled in at
-       the java level  */
-    if (datagramPacket != NULL) {
-      setDatagramPacketLength(env, datagramPacket, result);
-    }
-    return (jint) result;
+    throwJavaNetSocketException(env, result);
+    return (jint) 0;
+  }
+
+  /* Update the packet with the length of data received.  Since we are connected
+   * we did not get back an address.  This address is cached within the 
+   * PlainDatagramSocket java object and is filled in at the java level.
+   */
+  if (datagramPacket != NULL) {
+    setDatagramPacketLength(env, datagramPacket, result);
   }
+
+  return (jint) result;
 }
 
+
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
  * Method:    sendDatagram
@@ -1324,18 +1325,18 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    sendConnectedDatagramImpl
+ * Method:    sendConnectedDatagram
  * Signature: (Ljava/io/FileDescriptor;[BIIZ)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagram
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyteArray data,
    jint offset, jint msgLength, jboolean bindToDevice)
 {
   PORT_ACCESS_FROM_ENV(env);
   jbyte *message;
   jint result;
-  /* allocate a local buffer into which   we will copy the data to be sent and which we will use  
+  /* allocate a local buffer into which we will copy the data to be sent and which we will use  
      for the write call   */
   message = hymem_allocate_memory(msgLength);
   if (message == NULL) {
@@ -1344,22 +1345,22 @@
   }
   (*env)->GetByteArrayRegion(env, data, offset, msgLength, message);
   result =
-    Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirectImpl
-    (env, thisClz, fileDescriptor, (jlong) (IDATA)message, offset, msgLength,
+    Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirect
+    (env, thiz, fileDescriptor, (jlong) (IDATA)message, offset, msgLength,
      bindToDevice);
-  /* ok       free the buffer and return the length sent  */
+  /* ok free the buffer and return the length sent */
   hymem_free_memory(message);
   return result;
 }
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    sendConnectedDatagramDirectImpl
+ * Method:    sendConnectedDatagramDirect
  * Signature: (Ljava/io/FileDescriptor;JIIZ)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirectImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jlong address,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirect
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jlong address,
    jint offset, jint msgLength, jboolean bindToDevice)
 {
   PORT_ACCESS_FROM_ENV(env);
@@ -1732,9 +1733,15 @@
   }
 }
 
+
+/*
+ * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
+ * Method:    sendStream
+ * Signature: (Ljava/io/FileDescriptor;[BII)I
+ */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStreamImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStream
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyteArray data,
    jint offset, jint count)
 {
   PORT_ACCESS_FROM_ENV(env);
@@ -1793,27 +1800,25 @@
   if (result < 0) {
     throwJavaNetSocketException(env, result);
     return (jint) 0;
-  } else {
-    return (jint) sent;
   }
+
+  return (jint) sent;
 }
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    shutdownInputImpl
+ * Method:    shutdownInput
  * Signature: (Ljava/io/FileDescriptor;)V
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInputImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInput
+  (JNIEnv * env, jobject thiz, jobject fd)
 {
   PORT_ACCESS_FROM_ENV(env);
   I_32 result;
   hysocket_t socketP;
 
-  socketP =
-    (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env,
-                                                           fileDescriptor);
+  socketP = (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, fd);
   if (!hysock_socketIsValid(socketP)) {
     throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
     return;
@@ -1825,21 +1830,21 @@
   }
 }
 
+
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    shutdownOutputImpl
+ * Method:    shutdownOutput
  * Signature: (Ljava/io/FileDescriptor;)V
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutputImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutput
+  (JNIEnv * env, jobject thiz, jobject fd)
 {
   PORT_ACCESS_FROM_ENV(env);
   I_32 result;
   hysocket_t socketP;
 
-  socketP =
-    (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
+  socketP = (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, fd);
   if (!hysock_socketIsValid(socketP)) {
     throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
     return;
@@ -1851,15 +1856,16 @@
   }
 }
 
+
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    acceptStreamSocketImpl
+ * Method:    acceptStreamSocket
  * Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocketImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptorServer,
-   jobject socketImpl, jobject fileDescriptorSocketImpl, jint timeout)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocket
+  (JNIEnv * env, jobject thiz, jobject fdServer, jobject socketImpl,
+   jobject fdSocketImpl, jint timeout)
 {
   PORT_ACCESS_FROM_ENV(env);
   I_32 result;
@@ -1867,12 +1873,12 @@
   hysockaddr_struct sockaddrP;
   jbyte nlocalAddrBytes[HYSOCK_INADDR6_LEN];
 
-  result = pollSelectRead(env, fileDescriptorServer, timeout, TRUE);
-  if (0 > result)
+  result = pollSelectRead(env, fdServer, timeout, TRUE);
+  if (0 > result) {
     return;
+  }
 
-  socketS =
-    getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptorServer);
+  socketS = getJavaIoFileDescriptorContentsAsAPointer(env, fdServer);
   if (!hysock_socketIsValid(socketS)) {
     throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
     return;
@@ -1885,10 +1891,10 @@
   result = hysock_accept(socketS, &sockaddrP, &socketNew);
   if (0 != result) {
     throwJavaNetBindException(env, result);
-  } else {
-    updateSocket(env, &sockaddrP, socketNew, socketImpl,
-                 fileDescriptorSocketImpl);
+    return;
   }
+
+  updateSocket(env, &sockaddrP, socketNew, socketImpl, fdSocketImpl);
 }
 
 /*

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h?rev=719916&r1=719915&r2=719916&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h Sat Nov 22 12:48:45 2008
@@ -199,11 +199,11 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    sendUrgentDataImpl
+ * Method:    sendUrgentData
  * Signature: (Ljava/io/FileDescriptor;B)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentDataImpl
-  (JNIEnv *, jclass, jobject, jbyte);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentData
+  (JNIEnv *, jobject, jobject, jbyte);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
@@ -255,20 +255,19 @@
   
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    recvConnectedDatagramImpl
+ * Method:    recvConnectedDatagram
  * Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;[BIIIZ)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramImpl
-  (JNIEnv *, jclass, jobject, jobject, jbyteArray, jint, jint, jint, jboolean);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagram
+  (JNIEnv *, jobject, jobject, jobject, jbyteArray, jint, jint, jint, jboolean);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    recvConnectedDatagramDirectImpl
+ * Method:    recvConnectedDatagramDirect
  * Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;JIIIZ)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirectImpl
-  (JNIEnv *, jclass, jobject, jobject, jlong, jint, jint, jint, jboolean);
-  
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirect
+  (JNIEnv *, jobject, jobject, jobject, jlong, jint, jint, jint, jboolean);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
@@ -288,19 +287,19 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    sendConnectedDatagramImpl
+ * Method:    sendConnectedDatagram
  * Signature: (Ljava/io/FileDescriptor;[BIIZ)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramImpl
-  (JNIEnv *, jclass, jobject, jbyteArray, jint, jint, jboolean);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagram
+  (JNIEnv *, jobject, jobject, jbyteArray, jint, jint, jboolean);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    sendConnectedDatagramDirectImpl
+ * Method:    sendConnectedDatagramDirect
  * Signature: (Ljava/io/FileDescriptor;JIIZ)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirectImpl
-  (JNIEnv *, jclass, jobject, jlong, jint, jint, jboolean);  
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirect
+  (JNIEnv *, jobject, jobject, jlong, jint, jint, jboolean);  
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
@@ -328,35 +327,35 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    sendStreamImpl
+ * Method:    sendStream
  * Signature: (Ljava/io/FileDescriptor;[BII)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStreamImpl
-  (JNIEnv *, jclass, jobject, jbyteArray, jint, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStream
+  (JNIEnv *, jobject, jobject, jbyteArray, jint, jint);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    shutdownInputImpl
+ * Method:    shutdownInput
  * Signature: (Ljava/io/FileDescriptor;)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInputImpl
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInput
   (JNIEnv *, jobject, jobject);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    shutdownOutputImpl
+ * Method:    shutdownOutput
  * Signature: (Ljava/io/FileDescriptor;)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutputImpl
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutput
   (JNIEnv *, jobject, jobject);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    acceptStreamSocketImpl
+ * Method:    acceptStreamSocket
  * Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocketImpl
-  (JNIEnv *, jclass, jobject, jobject, jobject, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocket
+  (JNIEnv *, jobject, jobject, jobject, jobject, jint);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt?rev=719916&r1=719915&r2=719916&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt Sat Nov 22 12:48:45 2008
@@ -200,26 +200,26 @@
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStream
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_accept
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_supportsUrgentData
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentDataImpl
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentData
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagram
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_disconnectDatagram
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_bind2
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_peekDatagram
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirectImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirectImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirectImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirectImpl
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagram
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirect
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagram
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirect
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagram
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirect
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagram
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirect
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_createServerStreamSocket
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_createMulticastSocket
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveStream
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStreamImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInputImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutputImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocketImpl
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStream
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInput
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutput
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocket
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_createStreamSocket
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramImpl2
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl