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]

FYI: 3.4 branch - Re: ServerSocket::accept


I've verfied that this fix works, and checked the following patch into the 3.4 branch.

Regards

Bryce


Eric Wong wrote:


Hi Michael,

I didn't try your patch but i'm quite sure it will
work. I did a similar fix when i was real desperate
that day.


Maybe someone else could help verify the patch... my
machine would crawl for days to compile -- Sorry.

Oh like Bryce have said, please set it up at 3.4
branch fast, else many people will cry at their server
applications.

eric



2004-07-11  Michael Koch  <konqueror@gmx.de>

	PR libgcj/16473
	* java/net/ServerSocket.java (accept): Don't create two client 
	sockets when accepting connections.
	* java/net/Socket.java (impl): Made package-private.
	(implCreated): Likewise.

Index: java/net/ServerSocket.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/ServerSocket.java,v
retrieving revision 1.34.4.1
diff -u -r1.34.4.1 ServerSocket.java
--- java/net/ServerSocket.java	3 Feb 2004 14:50:59 -0000	1.34.4.1
+++ java/net/ServerSocket.java	11 Jul 2004 16:41:35 -0000
@@ -354,7 +354,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.33.4.1
diff -u -r1.33.4.1 Socket.java
--- java/net/Socket.java	3 Feb 2004 14:50:59 -0000	1.33.4.1
+++ java/net/Socket.java	11 Jul 2004 16:41:35 -0000
@@ -77,12 +77,14 @@
   /**
    * 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]