OSDN Git Service

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=233406
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 2 Apr 2007 22:10:41 +0000 (22:10 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 2 Apr 2007 22:10:41 +0000 (22:10 +0000)
* gnu/java/net/natPlainSocketImplPosix.cc (create): Return if
already created.
* gnu/java/net/PlainSocketImpl.java (getLocalAddress): Handle case
where localport is -1.
(create): Now public.
* gnu/java/nio/SocketChannelImpl.java (SocketChannelImpl): Call
'create' on the socket.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123440 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/classpath/lib/gnu/classpath/jdwp/event/ThreadStartEvent.class
libjava/classpath/lib/gnu/classpath/jdwp/transport/SocketTransport.class
libjava/classpath/lib/gnu/java/net/PlainSocketImpl$SocketInputStream.class
libjava/classpath/lib/gnu/java/net/PlainSocketImpl$SocketOutputStream.class
libjava/classpath/lib/gnu/java/net/PlainSocketImpl.class
libjava/classpath/lib/gnu/java/nio/SocketChannelImpl.class
libjava/gnu/java/net/PlainSocketImpl.java
libjava/gnu/java/net/natPlainSocketImplPosix.cc
libjava/gnu/java/nio/SocketChannelImpl.java

index dce810f..ca93983 100644 (file)
@@ -1,3 +1,14 @@
+2007-04-02  Tom Tromey  <tromey@redhat.com>
+
+       https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=233406
+       * gnu/java/net/natPlainSocketImplPosix.cc (create): Return if
+       already created.
+       * gnu/java/net/PlainSocketImpl.java (getLocalAddress): Handle case
+       where localport is -1.
+       (create): Now public.
+       * gnu/java/nio/SocketChannelImpl.java (SocketChannelImpl): Call
+       'create' on the socket.
+
 2007-04-02  Andrew Haley  <aph@redhat.com>
 
        * java/lang/reflect/natVMProxy.cc (run_proxy): Use
 2007-04-02  Andrew Haley  <aph@redhat.com>
 
        * java/lang/reflect/natVMProxy.cc (run_proxy): Use
index 05fd3dc..84f88dd 100644 (file)
Binary files a/libjava/classpath/lib/gnu/classpath/jdwp/event/ThreadStartEvent.class and b/libjava/classpath/lib/gnu/classpath/jdwp/event/ThreadStartEvent.class differ
index 8d7f093..eb7fc33 100644 (file)
Binary files a/libjava/classpath/lib/gnu/classpath/jdwp/transport/SocketTransport.class and b/libjava/classpath/lib/gnu/classpath/jdwp/transport/SocketTransport.class differ
index 5c42da8..28c8a6d 100644 (file)
Binary files a/libjava/classpath/lib/gnu/java/net/PlainSocketImpl$SocketInputStream.class and b/libjava/classpath/lib/gnu/java/net/PlainSocketImpl$SocketInputStream.class differ
index 739340f..58cd4b9 100644 (file)
Binary files a/libjava/classpath/lib/gnu/java/net/PlainSocketImpl$SocketOutputStream.class and b/libjava/classpath/lib/gnu/java/net/PlainSocketImpl$SocketOutputStream.class differ
index 1e26dd5..1eaf658 100644 (file)
Binary files a/libjava/classpath/lib/gnu/java/net/PlainSocketImpl.class and b/libjava/classpath/lib/gnu/java/net/PlainSocketImpl.class differ
index 26c94fc..88548eb 100644 (file)
Binary files a/libjava/classpath/lib/gnu/java/nio/SocketChannelImpl.class and b/libjava/classpath/lib/gnu/java/nio/SocketChannelImpl.class differ
index dad1724..d2c8f02 100644 (file)
@@ -228,7 +228,9 @@ public final class PlainSocketImpl extends SocketImpl
    *
    * @param stream true for a stream socket, false for a datagram socket
    */
    *
    * @param stream true for a stream socket, false for a datagram socket
    */
-  protected native void create(boolean stream) throws IOException;
+  // FIXME: this is public for nio ... but this is just a hack
+  // until we upgrade to Classpath's nio.
+  public native void create(boolean stream) throws IOException;
 
   /**
    * Connects to the remote hostname and port specified as arguments.
 
   /**
    * Connects to the remote hostname and port specified as arguments.
@@ -336,7 +338,7 @@ public final class PlainSocketImpl extends SocketImpl
          {
            localSocketAddress
              = new InetSocketAddress ((InetAddress) getOption(SocketOptions.SO_BINDADDR),
          {
            localSocketAddress
              = new InetSocketAddress ((InetAddress) getOption(SocketOptions.SO_BINDADDR),
-                                      localport);
+                                      localport == -1 ? 0 : localport);
          }
        catch (SocketException _)
          {
          }
        catch (SocketException _)
          {
index d16f1d3..b4f4a85 100644 (file)
@@ -64,6 +64,10 @@ union SockAddr
 void
 gnu::java::net::PlainSocketImpl::create (jboolean stream)
 {
 void
 gnu::java::net::PlainSocketImpl::create (jboolean stream)
 {
+  // We might already have been create()d in the nio case.
+  if (native_fd != -1)
+    return;
+
   int sock = _Jv_socket (AF_INET, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
 
   if (sock < 0)
   int sock = _Jv_socket (AF_INET, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
 
   if (sock < 0)
index cda86e8..5925712 100644 (file)
@@ -1,5 +1,5 @@
 /* SocketChannelImpl.java -- 
 /* SocketChannelImpl.java -- 
-   Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
 
 This file is part of GNU Classpath.
 
@@ -71,6 +71,7 @@ public final class SocketChannelImpl extends SocketChannel
   {
     super (provider);
     impl = new PlainSocketImpl();
   {
     super (provider);
     impl = new PlainSocketImpl();
+    impl.create(true);
     socket = new NIOSocket (impl, this);
     configureBlocking(true);
   }
     socket = new NIOSocket (impl, this);
     configureBlocking(true);
   }