You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/04/21 20:12:19 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/net PoolTcpEndpoint.java

costin      01/04/21 11:12:19

  Modified:    src/share/org/apache/tomcat/util/net PoolTcpEndpoint.java
  Log:
  Stop endpoint will create a socket and connect to the listenning port, to
  unblock accept().
  Part of 1418 fix.
  
  Revision  Changes    Path
  1.10      +10 -4     jakarta-tomcat/src/share/org/apache/tomcat/util/net/PoolTcpEndpoint.java
  
  Index: PoolTcpEndpoint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PoolTcpEndpoint.java	2001/03/02 04:11:48	1.9
  +++ PoolTcpEndpoint.java	2001/04/21 18:12:19	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v 1.9 2001/03/02 04:11:48 costin Exp $
  - * $Revision: 1.9 $
  - * $Date: 2001/03/02 04:11:48 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v 1.10 2001/04/21 18:12:19 costin Exp $
  + * $Revision: 1.10 $
  + * $Date: 2001/04/21 18:12:19 $
    *
    * ====================================================================
    *
  @@ -229,6 +229,7 @@
   
       public void startEndpoint() throws IOException, InstantiationException {
   	try {
  +	    //	    System.out.println("Creating socket " + port );
   	    if(factory==null)
   		factory=ServerSocketFactory.getDefault();
   	    if(serverSocket==null) {
  @@ -262,8 +263,13 @@
   	    tp.shutdown();
   	    running = false;
   	    try {
  +		// Need to create a connection to unlock the accept();
  +		Socket s=new Socket("127.0.0.1", port );
  +		s.close();
  +		//		System.out.println("Closing socket " + port );
   		serverSocket.close(); // XXX?
   	    } catch(Exception e) {
  +		e.printStackTrace();
   	    }
   	    serverSocket = null;
   	}
  @@ -277,7 +283,7 @@
       	    if (running) {
   		if(null!= serverSocket) {
   		    accepted = serverSocket.accept();
  -		    if(running == false) {
  +		    if(!running) {
   			if(null != accepted) {
   			    accepted.close();  // rude, but unlikely!
   			    accepted = null;