mturk       2005/07/02 03:55:35

  Modified:    util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Couple of fixes for Sendfile.
  The major is to remove the double call to the Socket.destroy if
  the return from senfile is ECONNRESET or similar.
  The socket will be destroyed on processSocket call too, so that
  made entile APR pool system in a unstable state.
  
  Revision  Changes    Path
  1.53      +6 -5      
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- AprEndpoint.java  29 Jun 2005 17:32:22 -0000      1.52
  +++ AprEndpoint.java  2 Jul 2005 10:55:34 -0000       1.53
  @@ -1102,7 +1102,7 @@
                       log.error(sm.getString("endpoint.poll.initfail"), e);
                   }
               }
  -            desc = new long[sendfileSize * 4];
  +            desc = new long[sendfileSize * 2];
               sendfileData = new HashMap(sendfileSize);
               addS = new ArrayList();
           }
  @@ -1153,8 +1153,9 @@
                                                data.pos, data.end, 0);
                       if (nw < 0) {
                           if (!(-nw == Status.EAGAIN)) {
  -                            Socket.destroy(data.socket);
  -                            data.socket = 0;
  +                             /* The socket will be destroyed on the
  +                              * return from the processSocket call
  +                              */
                               return false;
                           } else {
                               // Break the loop and add the socket to poller.
  @@ -1252,7 +1253,7 @@
                           for (int n = 0; n < rv; n++) {
                               // Get the sendfile state
                               SendfileData state =
  -                                (SendfileData) sendfileData.get(new 
Long(desc[n*4+1]));
  +                                (SendfileData) sendfileData.get(new 
Long(desc[n*2+1]));
                               // Problem events
                               if (((desc[n*2] & Poll.APR_POLLHUP) == 
Poll.APR_POLLHUP)
                                       || ((desc[n*2] & Poll.APR_POLLERR) == 
Poll.APR_POLLERR)) {
  @@ -1265,7 +1266,7 @@
                                   continue;
                               }
                               // Write some data using sendfile
  -                            long nw = Socket.sendfile(desc[n*2+1], state.fd,
  +                            long nw = Socket.sendfile(state.socket, state.fd,
                                                        null, null, state.pos,
                                                        state.end - state.pos, 
0);
                               if (nw < 0) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to