Something is wrong with this commit:

the new SocketWithOptionsProcessor#status field is always null.

It is assigned by the constructor and is never changed afterwards.
The constructor is called as new SocketWithOptionsProcessor(wrapper,
null), always passing null for the value.


> +        (martk)
I already corrected the above typo.

Best regards,
Konstantin Kolinko

2011/3/10  <ma...@apache.org>:
> Author: markt
> Date: Wed Mar  9 22:36:55 2011
> New Revision: 1080040
>
> URL: http://svn.apache.org/viewvc?rev=1080040&view=rev
> Log:
> Fix Async with APR and TCP_DEFER_ACCEPT
>
> Modified:
>    tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
>    tomcat/trunk/webapps/docs/changelog.xml
>
> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1080040&r1=1080039&r2=1080040&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Mar  9 
> 22:36:55 2011
> @@ -760,7 +760,8 @@ public class AprEndpoint extends Abstrac
>             if (running) {
>                 SocketWrapper<Long> wrapper =
>                     new SocketWrapper<Long>(Long.valueOf(socket));
> -                getExecutor().execute(new 
> SocketWithOptionsProcessor(wrapper));
> +                getExecutor().execute(
> +                        new SocketWithOptionsProcessor(wrapper, null));
>             }
>         } catch (RejectedExecutionException x) {
>             log.warn("Socket processing request was rejected for:"+socket,x);
> @@ -1641,9 +1642,13 @@ public class AprEndpoint extends Abstrac
>     protected class SocketWithOptionsProcessor implements Runnable {
>
>         protected SocketWrapper<Long> socket = null;
> +        protected SocketStatus status = null;
> +
>
> -        public SocketWithOptionsProcessor(SocketWrapper<Long> socket) {
> +        public SocketWithOptionsProcessor(SocketWrapper<Long> socket,
> +                SocketStatus status) {
>             this.socket = socket;
> +            this.status = status;
>         }
>
>         @Override
> @@ -1660,17 +1665,30 @@ public class AprEndpoint extends Abstrac
>                     }
>                 } else {
>                     // Process the request from this socket
> -                    if (!setSocketOptions(socket.getSocket().longValue())
> -                            || handler.process(socket) == 
> Handler.SocketState.CLOSED) {
> +                    if (!setSocketOptions(socket.getSocket().longValue())) {
>                         // Close socket and pool
>                         destroySocket(socket.getSocket().longValue());
>                         socket = null;
>                     }
> +                    // Process the request from this socket
> +                    Handler.SocketState state = 
> (status==null)?handler.process(socket):handler.asyncDispatch(socket, status);
> +                    if (state == Handler.SocketState.CLOSED) {
> +                        // Close socket and pool
> +                        destroySocket(socket.getSocket().longValue());
> +                        socket = null;
> +                    } else if (state == Handler.SocketState.LONG) {
> +                        socket.access();
> +                        if (socket.async) {
> +                            waitingRequests.add(socket);
> +                        }
> +                    } else if (state == Handler.SocketState.ASYNC_END) {
> +                        socket.access();
> +                        SocketProcessor proc = new SocketProcessor(socket, 
> SocketStatus.OPEN);
> +                        getExecutor().execute(proc);
> +                    }
>                 }
>             }
> -
>         }
> -
>     }
>
>
>
> Modified: tomcat/trunk/webapps/docs/changelog.xml
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1080040&r1=1080039&r2=1080040&view=diff
> ==============================================================================
> --- tomcat/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/trunk/webapps/docs/changelog.xml Wed Mar  9 22:36:55 2011
> @@ -90,6 +90,11 @@
>         <bug>48208</bug>: Allow the configuration of a custom trust manager 
> for
>         use in CLIENT-CERT authentication. (markt)
>       </add>
> +      <fix>
> +        Fix issues that prevented asynchronous servlets from working when 
> used
> +        with the HTTP APR connector on platforms that support 
> TCP_DEFER_ACCEPT.
> +        (martk)
> +      </fix>
>     </changelog>
>   </subsection>
>   <subsection name="Jasper">
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to