This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: java.net - fix for double socket creation


Hi list,


I just commited the attached patch to merge a fix from GNU classpath for 
double creation of a socket when using ServerSocket.accept().


Michael


2004-04-22  Michael Koch  <konqueror@gmx.de>

	* java/net/Socket.java
	(impl): Made package-private.
	* java/net/ServerSocket.java
	(implAccept): Access Socket.impl field directly.

Index: java/net/ServerSocket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/ServerSocket.java,v
retrieving revision 1.39
diff -u -r1.39 ServerSocket.java
--- java/net/ServerSocket.java	20 Apr 2004 20:32:41 -0000	1.39
+++ java/net/ServerSocket.java	22 Apr 2004 06:49:32 -0000
@@ -374,7 +374,8 @@
         && ! ((PlainSocketImpl) getImpl()).isInChannelOperation())
       throw new IllegalBlockingModeException();
 
-    impl.accept(socket.getImpl());
+    impl.accept(socket.impl);
+    socket.implCreated = true;
   }
 
   /**
Index: java/net/Socket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/Socket.java,v
retrieving revision 1.36
diff -u -r1.36 Socket.java
--- java/net/Socket.java	20 Apr 2004 13:05:09 -0000	1.36
+++ java/net/Socket.java	22 Apr 2004 06:49:32 -0000
@@ -78,13 +78,15 @@
   /**
    * The implementation object to which calls are redirected
    */
-  private SocketImpl impl;
+  // package-private because ServerSocket.implAccept() needs to access it.
+  SocketImpl impl;
 
   /**
    * True if socket implementation was created by calling their
    * create() method.
    */
-  private boolean implCreated;
+  // package-private because ServerSocket.implAccept() needs to access it.
+  boolean implCreated;
 
   /**
    * True if the socket is bound.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]