classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: Fix Socket.getLocalPort() return by binding SeverSocke


From: Mark Wielaard
Subject: [cp-patches] FYI: Fix Socket.getLocalPort() return by binding SeverSocket.accept() result
Date: Mon, 10 Oct 2005 00:05:01 +0200

Hi,

We weren't marking a Socket returned from ServerSocket.accept() as bound
which let us to report a bogus (-1) port number for such sockets.

2005-10-09  Mark Wielaard  <address@hidden>

    Fixes bug #24006
    * java/net/Socket.java (bound): Make package private.
    * java/net/ServerSocket.java (implAccept): Set Socket.bound to true.

Fixes the bug and the associated mauve test.

Committed,

Mark
Index: java/net/ServerSocket.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/ServerSocket.java,v
retrieving revision 1.42
diff -u -r1.42 ServerSocket.java
--- java/net/ServerSocket.java  22 Sep 2005 18:09:59 -0000      1.42
+++ java/net/ServerSocket.java  9 Oct 2005 22:01:45 -0000
@@ -370,6 +370,7 @@
 
     impl.accept(socket.impl);
     socket.implCreated = true;
+    socket.bound = true;
   }
 
   /**
Index: java/net/Socket.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/net/Socket.java,v
retrieving revision 1.52
diff -u -r1.52 Socket.java
--- java/net/Socket.java        2 Oct 2005 22:58:42 -0000       1.52
+++ java/net/Socket.java        9 Oct 2005 22:01:45 -0000
@@ -91,8 +91,9 @@
 
   /**
    * True if the socket is bound.
+   * Package private so it can be set from ServerSocket when accept is called.
    */
-  private boolean bound;
+  boolean bound;
 
   /**
    * True if input is shutdown.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]