costin      00/12/20 11:45:26

  Modified:    src/native/mod_jk/apache2.0 mod_jk.c
  Log:
  1. I'm a stupid C programmer.
  
  2. It seems to work now, by sending the buffer in chunks <= 4096.
  
  I'll try to run watchdog and more tests, only one bug is not a good sign :-)
  
  Revision  Changes    Path
  1.6       +12 -5     jakarta-tomcat/src/native/mod_jk/apache2.0/mod_jk.c
  
  Index: mod_jk.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/mod_jk/apache2.0/mod_jk.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mod_jk.c  2000/12/20 19:32:42     1.5
  +++ mod_jk.c  2000/12/20 19:45:23     1.6
  @@ -211,6 +211,9 @@
       return JK_FALSE;
   }
   
  +/* Works with 4096, fails with 8192 */
  +#define CHUNK_SIZE 4096
  +
   static int JK_METHOD ws_write(jk_ws_service_t *s,
                                 const void *b,
                                 unsigned l)
  @@ -223,6 +226,7 @@
               size_t w = (size_t)l;
               size_t r = 0;
            long ll=l;
  +         char *bb=b;
   
               if(!p->response_started) {
                   if(!s->start_response(s, 200, NULL, NULL, NULL, 0)) {
  @@ -232,14 +236,17 @@
               
            // Debug - try to get around rwrite
            while( ll > 0 ) {
  -             long toSend=(ll>2048) ? 2048 : ll;
  -             r = ap_rwrite((const char *)b, toSend, p->r );
  -             ll-=2048;
  -             
  +             long toSend=(ll>CHUNK_SIZE) ? CHUNK_SIZE : ll;
  +             r = ap_rwrite((const char *)bb, toSend, p->r );
                // DEBUG 
  +#ifdef JK_DEBUG
                ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, 
  -                          NULL, "mod_jk: writing %ld (%ld) out of %ld bytes \n",  
  +                          NULL, "mod_jk: writing %ld (%ld) out of %ld \n",
                             toSend, r, ll );
  +#endif
  +             ll-=CHUNK_SIZE;
  +             bb+=CHUNK_SIZE;
  +             
                if(toSend != r) { 
                    return JK_FALSE; 
                } 
  
  
  

Reply via email to