cvs commit: jakarta-tomcat-connectors/jk/native/iis jk_isapi_plugin.c

2005-09-23 Thread mturk
mturk   2005/09/22 23:35:10

  Modified:jk/native/iis jk_isapi_plugin.c
  Log:
  Use simple Translate header for multiple instances.
  Patch provided by Tim Whittington fixes #35298.
  
  Revision  ChangesPath
  1.54  +7 -4  jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- jk_isapi_plugin.c 14 Sep 2005 10:52:43 -  1.53
  +++ jk_isapi_plugin.c 23 Sep 2005 06:35:10 -  1.54
  @@ -79,6 +79,10 @@
   #define URI_SELECT_UNPARSED_VERB(unparsed)
   #define URI_SELECT_ESCAPED_VERB (escaped)
   
  +#define TRANSLATE_HEADER  (Translate:)
  +#define TRANSLATE_HEADER_NAME (Translate)
  +#define TRANSLATE_HEADER_NAME_LC  (translate)
  +
   #define BAD_REQUEST -1
   #define BAD_PATH-2
   #define MAX_SERVERNAME  128
  @@ -907,7 +911,7 @@
* This allows the servlet to handle 'Translate: f'.
*/
   if (GetHeader
  -(pfc, Translate:, (LPVOID) Translate,
  +(pfc, TRANSLATE_HEADER, (LPVOID) Translate,
(LPDWORD)  szTranslate)  Translate != NULL
szTranslate  0) {
   if (!AddHeader
  @@ -1555,8 +1559,7 @@
   }
   else if (!strnicmp(tmp, TOMCAT_TRANSLATE_HEADER_NAME,
  strlen(TOMCAT_TRANSLATE_HEADER_NAME))) {
  -tmp += 6;   /* TOMCAT */
  -s-headers_names[i] = tmp;
  +s-headers_names[i] = TRANSLATE_HEADER_NAME_LC;
   }
   else {
   s-headers_names[i] = tmp;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/iis jk_isapi_plugin.c

2005-09-23 Thread mturk
mturk   2005/09/22 23:54:16

  Modified:jk/native/iis jk_isapi_plugin.c
  Log:
  Remove temporary HTTP_TOMCATQUERY header from
  ALL_HTTP. Patch provided by Tim Whittington that fixes #36765
  
  Revision  ChangesPath
  1.55  +13 -2 jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- jk_isapi_plugin.c 23 Sep 2005 06:35:10 -  1.54
  +++ jk_isapi_plugin.c 23 Sep 2005 06:54:16 -  1.55
  @@ -1529,7 +1529,10 @@
   size_t len_of_http_prefix = strlen(HTTP_);
   BOOL need_content_length_header = (s-content_length == 0);
   
  -cnt -= 2;   /* For our two special headers */
  +cnt -= 2;   /* For our two special headers:
  + * HTTP_TOMCATURI_
  + * HTTP_TOMCATWORKER_
  + */
   /* allocate an extra header slot in case we need to add a 
content-length header */
   s-headers_names =
   jk_pool_alloc(private_data-p, (cnt + 1) * sizeof(char *));
  @@ -1551,6 +1554,14 @@
strlen(WORKER_HEADER_NAME))) {
   real_header = JK_FALSE;
   }
  +else if (!strnicmp(tmp, QUERY_HEADER_NAME,
  +   strlen(QUERY_HEADER_NAME))) {
  +/* HTTP_TOMCATQUERY_ was supplied,
  + * remove it from the count and skip
  + */
  +cnt--;
  +real_header = JK_FALSE;
  +}
   else if (need_content_length_header 
!strnicmp(tmp, CONTENT_LENGTH,
  strlen(CONTENT_LENGTH))) {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c

2005-09-23 Thread mturk
mturk   2005/09/23 00:18:21

  Modified:jk/native/common jk_lb_worker.c
  Log:
  Fix loadbalancer retries to allow usage of cachesize lower then
  number of threads. In case the worker is busy having no free endpoints,
  and the retries config value is larger the total number of workers in load
  balancer, for each consequitive attempt sleep for a 100 ms, rather then
  returning 503.
  
  Revision  ChangesPath
  1.95  +11 -10jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- jk_lb_worker.c16 Sep 2005 05:52:26 -  1.94
  +++ jk_lb_worker.c23 Sep 2005 07:18:21 -  1.95
  @@ -595,7 +595,7 @@
   
   while (num_of_workers) {
   worker_record_t *rec =
  -get_most_suitable_worker(p-worker, s, attempt++, l);
  +get_most_suitable_worker(p-worker, s, attempt, l);
   int rc;
   /* Do not reuse previous worker, because
* that worker already failed.
  @@ -650,20 +650,21 @@
   else {
   /* If we can not get the endpoint
* mark the worker as busy rather then
  - * as in error
  + * as in error if the attemp number is
  + * greater then the number of retries.
*/
  -if (p-worker-s-retries  num_of_workers)
  +attempt++;
  +if (attempt  p-worker-s-retries) {
   rec-s-is_busy = JK_TRUE;
  +num_of_workers = 0;
  +}
   jk_log(l, JK_LOG_INFO,
  could not get free endpoint for worker %s 
(attempt %d),
  rec-s-name, attempt);
  -/* Decrement the worker count and try another worker */
  -if (attempt  p-worker-s-retries)
  -num_of_workers = 0;
  -/* In case of retries  3 sleep 100 ms
  - * on each next attempt.
  +/* In case of attempt  num of workers sleep for 100 ms
  + * on each consequtive attempt.
*/
  -else if (attempt  JK_RETRIES)
  +if (attempt  p-worker-num_of_workers)
   jk_sleep_def();
   continue;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c

2005-09-23 Thread mturk
mturk   2005/09/23 00:32:24

  Modified:jk/native/common jk_lb_worker.c
  Log:
  Fix compile time warnings. No functional change.
  
  Revision  ChangesPath
  1.96  +4 -4  jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- jk_lb_worker.c23 Sep 2005 07:18:21 -  1.95
  +++ jk_lb_worker.c23 Sep 2005 07:32:24 -  1.96
  @@ -126,8 +126,8 @@
   result = id_start;
   }
   else {
  -int osz = strlen(result) + 1;
  -int sz = osz + strlen(id_start) + 1;
  +size_t osz = strlen(result) + 1;
  +size_t sz = osz + strlen(id_start) + 1;
   result =
   jk_pool_realloc(s-pool, sz, result, osz);
   strcat(result, ;);
  @@ -664,7 +664,7 @@
   /* In case of attempt  num of workers sleep for 100 ms
* on each consequtive attempt.
*/
  -if (attempt  p-worker-num_of_workers)
  +if (attempt  (int)p-worker-num_of_workers)
   jk_sleep_def();
   continue;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_status.c

2005-09-23 Thread mturk
mturk   2005/09/23 00:57:28

  Modified:jk/native/common jk_status.c
  Log:
  Added cmd=reset status command without web interface that
  will reset all workers in selected load balancer and reset their
  runtime data. This is usefull for cron jobs to skip the need to
  cold restart apache.
  
  Revision  ChangesPath
  1.47  +43 -2 jakarta-tomcat-connectors/jk/native/common/jk_status.c
  
  Index: jk_status.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_status.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- jk_status.c   16 Sep 2005 05:52:26 -  1.46
  +++ jk_status.c   23 Sep 2005 07:57:28 -  1.47
  @@ -738,6 +738,32 @@
   }
   }
   
  +static void reset_worker(jk_ws_service_t *s, status_worker_t *sw,
  + const char *dworker, jk_logger_t *l)
  +{
  +unsigned int i;
  +lb_worker_t *lb;
  +jk_worker_t *w = wc_get_worker_for_name(dworker, l);
  +
  +if (w  w-type == JK_LB_WORKER_TYPE) {
  +lb = (lb_worker_t *)w-worker_private;
  +for (i = 0; i  lb-num_of_workers; i++) {
  +worker_record_t *wr = (lb-lb_workers[i]);
  +wr-s-busy = 0;
  +wr-s-elected  = 0;
  +wr-s-error_time   = 0;
  +wr-s-errors   = 0;
  +wr-s-lb_value = 0;
  +wr-s-max_busy = 0;
  +wr-s-readed   = 0;
  +wr-s-transferred  = 0;
  +wr-s-is_busy  = JK_FALSE;
  +wr-s-in_error_state   = JK_FALSE;
  +wr-s-in_recovering= JK_FALSE;
  +}
  +}
  +}
  +
   static int status_cmd_type(const char *req)
   {
   if (!req)
  @@ -748,6 +774,8 @@
   return 1;
   else if (!strncmp(req, cmd=update, 10))
   return 2;
  +else if (!strncmp(req, cmd=reset, 9))
  +return 3;
   else
   return 0;
   }
  @@ -800,7 +828,20 @@
   /* unlock the shared memory */
   jk_shm_unlock();
   }
  -if(mime == 0) {
  +else if ((cmd == 3)  worker) {
  +/* lock shared memory */
  +jk_shm_lock();
  +reset_worker(s, p-s_worker, worker, l);
  +/* update modification time to reflect the current config */
  +jk_shm_set_workers_time(time(NULL));
  +/* Since we updated the config no need to reload
  + * on the next request
  + */
  +jk_shm_sync_access_time();
  +/* unlock the shared memory */
  +jk_shm_unlock();
  +}
  +if (mime == 0) {
   s-start_response(s, 200, OK, headers_names, headers_vhtml, 3);
   s-write(s, JK_STATUS_HEAD, sizeof(JK_STATUS_HEAD) - 1);
   if (p-s_worker-css) {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_version.h

2005-09-23 Thread mturk
mturk   2005/09/23 04:44:44

  Modified:jk/native/common jk_version.h
  Log:
  Bump the release version
  
  Revision  ChangesPath
  1.46  +2 -2  jakarta-tomcat-connectors/jk/native/common/jk_version.h
  
  Index: jk_version.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_version.h,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- jk_version.h  26 Jul 2005 16:04:10 -  1.45
  +++ jk_version.h  23 Sep 2005 11:44:44 -  1.46
  @@ -32,7 +32,7 @@
   #define JK_VERBETA  0
   #define JK_BETASTRING   0
   /* set JK_VERISRELEASE to 1 when release (do not forget to commit!) */
  -#define JK_VERISRELEASE 0
  +#define JK_VERISRELEASE 1
   #define JK_VERRC0
   #define JK_RCSTRING 0
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_connect.h

2005-09-23 Thread mturk
mturk   2005/09/23 04:49:04

  Modified:jk/native/common jk_connect.h
  Log:
  Fix compile time warning
  
  Revision  ChangesPath
  1.17  +2 -2  jakarta-tomcat-connectors/jk/native/common/jk_connect.h
  
  Index: jk_connect.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- jk_connect.h  14 Sep 2005 06:45:00 -  1.16
  +++ jk_connect.h  23 Sep 2005 11:49:03 -  1.17
  @@ -55,7 +55,7 @@
   
   int jk_is_socket_connected(int sd);
   
  -void jk_sleep_def();
  +void jk_sleep_def(void);
   
   #ifdef __cplusplus
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_version.h

2005-09-23 Thread mturk
mturk   2005/09/23 04:51:51

  Modified:jk/native/common jk_version.h
  Log:
  Bump to 1.2.16-dev verion.
  We are ready for SVN transition.
  
  Revision  ChangesPath
  1.47  +4 -4  jakarta-tomcat-connectors/jk/native/common/jk_version.h
  
  Index: jk_version.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_version.h,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- jk_version.h  23 Sep 2005 11:44:44 -  1.46
  +++ jk_version.h  23 Sep 2005 11:51:50 -  1.47
  @@ -25,14 +25,14 @@
   /** START OF AREA TO MODIFY BEFORE RELEASING */
   #define JK_VERMAJOR 1
   #define JK_VERMINOR 2
  -#define JK_VERFIX   15
  -#define JK_VERSTRING1.2.15
  +#define JK_VERFIX   16
  +#define JK_VERSTRING1.2.16
   
   /* Beta number */
   #define JK_VERBETA  0
   #define JK_BETASTRING   0
   /* set JK_VERISRELEASE to 1 when release (do not forget to commit!) */
  -#define JK_VERISRELEASE 1
  +#define JK_VERISRELEASE 0
   #define JK_VERRC0
   #define JK_RCSTRING 0
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.c jk_shm.h jk_status.c

2005-09-15 Thread mturk
mturk   2005/09/15 22:52:26

  Modified:jk/native/common jk_lb_worker.c jk_shm.c jk_shm.h
jk_status.c
  Log:
  Fix bug #36525 by properly aligning shared memory header struct.
  This patch was provided and investigated by Rainer Jung. Thaks!
  
  Also bring back 64 bit sizes, because the problem was not with them,
  but rather they've cause different struct alignment.
  
  Revision  ChangesPath
  1.94  +5 -5  jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- jk_lb_worker.c14 Sep 2005 06:50:14 -  1.93
  +++ jk_lb_worker.c16 Sep 2005 05:52:26 -  1.94
  @@ -225,8 +225,8 @@
   {
   unsigned int i;
   int total_factor = 0;
  -size_t mytraffic = 0;
  -size_t curmin = 0;
  +jk_u64_t mytraffic = 0;
  +jk_u64_t curmin = 0;
   
   worker_record_t *candidate = NULL;
   if (p-lblock == JK_LB_LOCK_PESSIMISTIC)
  @@ -328,8 +328,8 @@
jk_logger_t *l)
   {
   unsigned int i;
  -size_t mytraffic = 0;
  -size_t curmin = 0;
  +jk_u64_t mytraffic = 0;
  +jk_u64_t curmin = 0;
   worker_record_t *candidate = NULL;
   double diff;
   time_t now = time(NULL);
  
  
  
  1.20  +33 -22jakarta-tomcat-connectors/jk/native/common/jk_shm.c
  
  Index: jk_shm.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_shm.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- jk_shm.c  12 Sep 2005 12:53:05 -  1.19
  +++ jk_shm.c  16 Sep 2005 05:52:26 -  1.20
  @@ -26,8 +26,8 @@
   #include jk_mt.h
   #include jk_shm.h
   
  -/** jk shm header record structure */
  -struct jk_shm_header
  +/** jk shm header core data structure */
  +struct jk_shm_header_data
   {
   /* Shared memory magic JK_SHM_MAGIC */
   char   magic[8];
  @@ -36,6 +36,17 @@
   unsigned int childs;
   unsigned int workers;
   time_t modified;
  +};
  +
  +typedef struct jk_shm_header_data jk_shm_header_data_t;
  +
  +/** jk shm header record structure */
  +struct jk_shm_header
  +{
  +union {
  +jk_shm_header_data_t data;
  +char alignbuf[JK_SHM_ALIGN(sizeof(jk_shm_header_data_t))];
  +};
   char   buf[1];
   };
   
  @@ -116,13 +127,13 @@
   jk_shmem.filename = memory;
   jk_shmem.fd   = 0;
   jk_shmem.attached = 0;
  -memcpy(jk_shmem.hdr-magic, shm_signature, 8);
  -jk_shmem.hdr-size = sz;
  +memcpy(jk_shmem.hdr-data.magic, shm_signature, 8);
  +jk_shmem.hdr-data.size = sz;
   JK_INIT_CS((jk_shmem.cs), rc);
   if (JK_IS_DEBUG_LEVEL(l))
   jk_log(l, JK_LOG_DEBUG,
  Initialized shared memory size=%u free=%u addr=%#lx,
  -   jk_shmem.size, jk_shmem.hdr-size, jk_shmem.hdr);
  +   jk_shmem.size, jk_shmem.hdr-data.size, jk_shmem.hdr);
   JK_TRACE_EXIT(l);
   return 0;
   }
  @@ -132,12 +143,12 @@
   JK_TRACE_ENTER(l);
   if (!jk_shm_open(fname, sz, l)) {
   jk_shmem.attached = 1;
  -jk_shmem.hdr-childs++;
  +jk_shmem.hdr-data.childs++;
   if (JK_IS_DEBUG_LEVEL(l))
   jk_log(l, JK_LOG_DEBUG,
  Attached shared memory [%d] size=%u free=%u addr=%#lx,
  -   jk_shmem.hdr-childs, jk_shmem.hdr-size,
  -   jk_shmem.hdr-size - jk_shmem.hdr-pos,
  +   jk_shmem.hdr-data.childs, jk_shmem.hdr-data.size,
  +   jk_shmem.hdr-data.size - jk_shmem.hdr-data.pos,
  jk_shmem.hdr);
   JK_TRACE_EXIT(l);
   return 0;
  @@ -306,20 +317,20 @@
   /* Clear shared memory */
   if (!attached) {
   memset(jk_shmem.hdr, 0, jk_shmem.size);
  -memcpy(jk_shmem.hdr-magic, shm_signature, 8);
  -jk_shmem.hdr-size = sz;
  +memcpy(jk_shmem.hdr-data.magic, shm_signature, 8);
  +jk_shmem.hdr-data.size = sz;
   if (JK_IS_DEBUG_LEVEL(l))
   jk_log(l, JK_LOG_DEBUG,
  Initialized shared memory size=%u free=%u addr=%#lx,
  -   jk_shmem.size, jk_shmem.hdr-size, jk_shmem.hdr);
  +   jk_shmem.size, jk_shmem.hdr-data.size, jk_shmem.hdr);
   }
   else {
  -jk_shmem.hdr-childs++;
  +jk_shmem.hdr-data.childs++;
   if (JK_IS_DEBUG_LEVEL(l))
   jk_log(l, JK_LOG_INFO,
  Attached shared memory [%d] size=%u free=%u addr=%#lx,
  -   jk_shmem.hdr-childs, jk_shmem.hdr-size,
  -   jk_shmem.hdr-size - jk_shmem.hdr-pos

cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.h

2005-09-14 Thread mturk
mturk   2005/09/13 23:45:00

  Modified:jk/native/common jk_ajp_common.c jk_connect.h
  Log:
  Make jk_sleep_def as nonstatic.
  
  Revision  ChangesPath
  1.120 +2 -2  
jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c
  
  Index: jk_ajp_common.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v
  retrieving revision 1.119
  retrieving revision 1.120
  diff -u -r1.119 -r1.120
  --- jk_ajp_common.c   26 May 2005 14:36:14 -  1.119
  +++ jk_ajp_common.c   14 Sep 2005 06:45:00 -  1.120
  @@ -36,7 +36,7 @@
   #endif
   
   /* Sleep for 100ms */
  -static void jk_sleep_def(void)
  +void jk_sleep_def(void)
   {
   #ifdef OS2
   DosSleep(100);
  
  
  
  1.16  +3 -1  jakarta-tomcat-connectors/jk/native/common/jk_connect.h
  
  Index: jk_connect.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_connect.h  24 Apr 2005 09:52:57 -  1.15
  +++ jk_connect.h  14 Sep 2005 06:45:00 -  1.16
  @@ -55,6 +55,8 @@
   
   int jk_is_socket_connected(int sd);
   
  +void jk_sleep_def();
  +
   #ifdef __cplusplus
   }
   #endif  /* __cplusplus */
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/xdocs changelog.xml

2005-09-14 Thread mturk
mturk   2005/09/13 23:50:14

  Modified:jk/native/common jk_lb_worker.c
   jk/xdocs changelog.xml
  Log:
  Fix lb for worker mpm's with cachesize set to lower number then
  ThreadsPerChild is. If retries is set to value larger then 3 sleep for
  100 ms on each attempt. This enables to tune the connection cache,
  and serialize incoming connections instead returning busy if connection
  count is larger then cachesize.
  
  Revision  ChangesPath
  1.93  +14 -6 jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- jk_lb_worker.c12 Sep 2005 12:53:05 -  1.92
  +++ jk_lb_worker.c14 Sep 2005 06:50:14 -  1.93
  @@ -652,13 +652,19 @@
* mark the worker as busy rather then
* as in error
*/
  -rec-s-is_busy = JK_TRUE;
  +if (p-worker-s-retries  num_of_workers)
  +rec-s-is_busy = JK_TRUE;
   jk_log(l, JK_LOG_INFO,
  -   could not get free endpoint for worker %s,
  -   rec-s-name);
  +   could not get free endpoint for worker %s 
(attempt %d),
  +   rec-s-name, attempt);
   /* Decrement the worker count and try another worker */
  ---num_of_workers;
  -prec = rec;
  +if (attempt  p-worker-s-retries)
  +num_of_workers = 0;
  +/* In case of retries  3 sleep 100 ms
  + * on each next attempt.
  + */
  +else if (attempt  JK_RETRIES)
  +jk_sleep_def();
   continue;
   }
   if (service_stat == JK_FALSE) {
  @@ -725,6 +731,7 @@
   jk_log(l, JK_LOG_DEBUG,
  recoverable error... will try to recover on 
other host);
   }
  +#if 0
   else {
   /* NULL record, no more workers left ... */
   jk_log(l, JK_LOG_ERROR,
  @@ -733,6 +740,7 @@
   *is_error = JK_HTTP_SERVER_BUSY;
   return JK_FALSE;
   }
  +#endif
   --num_of_workers;
   prec = rec;
   }
  
  
  
  1.42  +7 -0  jakarta-tomcat-connectors/jk/xdocs/changelog.xml
  
  Index: changelog.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/xdocs/changelog.xml,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- changelog.xml 12 Sep 2005 14:29:49 -  1.41
  +++ changelog.xml 14 Sep 2005 06:50:14 -  1.42
  @@ -26,6 +26,13 @@
 subsection name=Native
   changelog
 fix
  +Fix lb for worker mpm's with cachesize set to lower number then
  +ThreadsPerChild is. If retries is set to value larger then 3 sleep 
for
  +100 ms on each attempt. This enables to tune the connection cache,
  +and serialize incoming connections instead returning busy if 
connection
  +count is larger then cachesize. (mturk)
  +  /fix
  +  fix
 bug36525/bug: Solaris core dump. (mturk)
 /fix
 fix
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/iis jk_isapi_plugin.c

2005-09-14 Thread mturk
mturk   2005/09/14 03:52:44

  Modified:jk/native/iis jk_isapi_plugin.c
  Log:
  Fix patch 35298. The patch was lacking the HTTP_ prefix headers
  with dll instance postfix. Also the postfix is bogus if there is underscore
  between header names. Probably the IIS issue.
  
  Revision  ChangesPath
  1.53  +29 -21jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- jk_isapi_plugin.c 12 Sep 2005 14:10:51 -  1.52
  +++ jk_isapi_plugin.c 14 Sep 2005 10:52:43 -  1.53
  @@ -51,26 +51,25 @@
* 3. The contents of the Translate header, if any
*
*/
  -#define URI_HEADER_NAME_BASE (TOMCATURI)
  -#define QUERY_HEADER_NAME_BASE   (TOMCATQUERY)
  -#define WORKER_HEADER_NAME_BASE  (TOMCATWORKER)
  +#define URI_HEADER_NAME_BASE  (TOMCATURI)
  +#define QUERY_HEADER_NAME_BASE(TOMCATQUERY)
  +#define WORKER_HEADER_NAME_BASE   (TOMCATWORKER)
   #define TOMCAT_TRANSLATE_HEADER_NAME_BASE (TOMCATTRANSLATE)
  +#define CONTENT_LENGTH(CONTENT_LENGTH:)
  +/* The template used to construct our unique headers
  + * from the base name and module instance
  + */
  +#define HEADER_TEMPLATE  (%s%p:)
  +#define HTTP_HEADER_TEMPLATE (HTTP_%s%p)
   
   static char URI_HEADER_NAME[_MAX_FNAME];
   static char QUERY_HEADER_NAME[_MAX_FNAME];
   static char WORKER_HEADER_NAME[_MAX_FNAME];
   static char TOMCAT_TRANSLATE_HEADER_NAME[_MAX_FNAME];
   
  -/* The template used to construct our unique headers
  - * from the base name and module instance
  - */
  -#define HEADER_TEMPLATE (%s_%p:)
  -
  -#define CONTENT_LENGTH   (CONTENT_LENGTH)
  -
  -#define HTTP_URI_HEADER_NAME (HTTP_TOMCATURI)
  -#define HTTP_QUERY_HEADER_NAME   (HTTP_TOMCATQUERY)
  -#define HTTP_WORKER_HEADER_NAME  (HTTP_TOMCATWORKER)
  +static char HTTP_URI_HEADER_NAME[_MAX_FNAME];
  +static char HTTP_QUERY_HEADER_NAME[_MAX_FNAME];
  +static char HTTP_WORKER_HEADER_NAME[_MAX_FNAME];
   
   #define REGISTRY_LOCATION   (Software\\Apache Software 
Foundation\\Jakarta Isapi Redirector\\1.0)
   #define EXTENSION_URI_TAG   (extension_uri)
  @@ -133,7 +132,7 @@
   static int iis5 = -1;
   
   static jk_uri_worker_map_t *uw_map = NULL;
  -static jk_map_t *wp_map = NULL; /* worker_properties */
  +static jk_map_t *workers_map = NULL;
   static jk_logger_t *logger = NULL;
   static char *SERVER_NAME = SERVER_NAME;
   static char *SERVER_SOFTWARE = SERVER_SOFTWARE;
  @@ -1071,9 +1070,9 @@
   uri_worker_map_free(uw_map, logger);
   is_mapread = JK_FALSE;
   }
  -memset(worker_env, 0, sizeof(worker_env));
  -if (wp_map) {
  -jk_map_free(wp_map);
  +if (workers_map) {
  +jk_map_free(workers_map);
  +workers_map = NULL;
   }
   wc_close(logger);
   if (logger) {
  @@ -,6 +1110,11 @@
   sprintf(QUERY_HEADER_NAME, HEADER_TEMPLATE, QUERY_HEADER_NAME_BASE, 
hInst);
   sprintf(WORKER_HEADER_NAME, HEADER_TEMPLATE, 
WORKER_HEADER_NAME_BASE, hInst);
   sprintf(TOMCAT_TRANSLATE_HEADER_NAME, HEADER_TEMPLATE, 
TOMCAT_TRANSLATE_HEADER_NAME_BASE, hInst);
  +
  +sprintf(HTTP_URI_HEADER_NAME, HTTP_HEADER_TEMPLATE, 
URI_HEADER_NAME_BASE, hInst);
  +sprintf(HTTP_QUERY_HEADER_NAME, HTTP_HEADER_TEMPLATE, 
QUERY_HEADER_NAME_BASE, hInst);
  +sprintf(HTTP_WORKER_HEADER_NAME, HTTP_HEADER_TEMPLATE, 
WORKER_HEADER_NAME_BASE, hInst);
  +
   break;
   case DLL_PROCESS_DETACH:
   __try {
  @@ -1168,14 +1172,14 @@
   }
   if (rc) {
   rc = JK_FALSE;
  -if (jk_map_alloc(wp_map)) {
  -if (jk_map_read_properties(wp_map, worker_file, NULL)) {
  +if (jk_map_alloc(workers_map)) {
  +if (jk_map_read_properties(workers_map, worker_file, NULL)) {
   /* we add the URI-WORKER MAP since workers using AJP14 will 
feed it */
   
   worker_env.uri_to_worker = uw_map;
   worker_env.server_name = serverName;
   
  -if (wc_open(wp_map, worker_env, logger)) {
  +if (wc_open(workers_map, worker_env, logger)) {
   rc = JK_TRUE;
   }
   }
  @@ -1183,6 +1187,10 @@
   jk_log(logger, JK_LOG_EMERG,
  Unable to read worker file %s., worker_file);
   }
  +if (rc != JK_TRUE) {
  +jk_map_free(workers_map);
  +workers_map = NULL;
  +}
   }
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL

cvs commit: jakarta-tomcat-connectors/jk/native/common jk_lb_worker.c jk_shm.c jk_shm.h jk_status.c

2005-09-12 Thread mturk
mturk   2005/09/12 05:53:06

  Modified:jk/native/common jk_lb_worker.c jk_shm.c jk_shm.h
jk_status.c
  Log:
  Fix bug #36525 by not using 64 bit ints in shared memory.
  For some strange reasons both Solaris and Irix are core dumping.
  To deal with long running data implement read and transferred as
  function of time, so that the troughput is stored rather then absolute
  value
  
  Revision  ChangesPath
  1.92  +39 -12jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- jk_lb_worker.c14 Jun 2005 06:34:13 -  1.91
  +++ jk_lb_worker.c12 Sep 2005 12:53:05 -  1.92
  @@ -225,12 +225,27 @@
   {
   unsigned int i;
   int total_factor = 0;
  -jk_u64_t mytraffic = 0;
  -jk_u64_t curmin = 0;
  +size_t mytraffic = 0;
  +size_t curmin = 0;
   
   worker_record_t *candidate = NULL;
   if (p-lblock == JK_LB_LOCK_PESSIMISTIC)
   jk_shm_lock();
  +
  +if (p-lbmethod == JK_LB_BYTRAFFIC) {
  +double diff;
  +time_t now = time(NULL);
  +/* Update transfer rate for each worker */
  +for (i = 0; i  p-num_of_workers; i++) {
  +diff = difftime(now, p-lb_workers[i].s-service_time);
  +if (diff  JK_SERVICE_TRANSFER_INTERVAL) {
  +p-lb_workers[i].s-service_time = now;
  +p-lb_workers[i].s-readed /= JK_SERVICE_TRANSFER_INTERVAL;
  +p-lb_workers[i].s-transferred /= 
JK_SERVICE_TRANSFER_INTERVAL;
  +}
  +}
  +}
  +
   /* First try to see if we have available candidate */
   for (i = 0; i  p-num_of_workers; i++) {
   /* Skip all workers that are not member of domain */
  @@ -248,14 +263,14 @@
   candidate = p-lb_workers[i];
   }
   else {
  -mytraffic = 
(p-lb_workers[i].s-transferred/p-lb_workers[i].s-lb_factor) +
  -
(p-lb_workers[i].s-readed/p-lb_workers[i].s-lb_factor);
  +mytraffic = (p-lb_workers[i].s-transferred +
  + p-lb_workers[i].s-readed ) / 
p-lb_workers[i].s-lb_factor;
   if (!candidate || mytraffic  curmin) {
   candidate = p-lb_workers[i];
   curmin = mytraffic;
   }
   }
  -}
  +}
   }
   
   if (candidate) {
  @@ -313,12 +328,22 @@
jk_logger_t *l)
   {
   unsigned int i;
  -jk_u64_t mytraffic = 0;
  -jk_u64_t curmin = 0;
  +size_t mytraffic = 0;
  +size_t curmin = 0;
   worker_record_t *candidate = NULL;
  +double diff;
  +time_t now = time(NULL);
   
   if (p-lblock == JK_LB_LOCK_PESSIMISTIC)
   jk_shm_lock();
  +for (i = 0; i  p-num_of_workers; i++) {
  +diff = difftime(now, p-lb_workers[i].s-service_time);
  +if (diff  JK_SERVICE_TRANSFER_INTERVAL) {
  +p-lb_workers[i].s-service_time = now;
  +p-lb_workers[i].s-readed /= JK_SERVICE_TRANSFER_INTERVAL;
  +p-lb_workers[i].s-transferred /= JK_SERVICE_TRANSFER_INTERVAL;
  +}
  +}
   /* First try to see if we have available candidate */
   for (i = 0; i  p-num_of_workers; i++) {
   /* If the worker is in error state run
  @@ -587,8 +612,8 @@
   jk_log(l, JK_LOG_DEBUG,
  service worker=%s jvm_route=%s,
  rec-s-name, s-jvm_route);
  -rec-s-elected++;
   if (rc  end) {
  +rec-s-elected++;
   /* Reset endpoint read and write sizes for
* this request.
*/
  @@ -602,8 +627,10 @@
   rec-s-max_busy = rec-s-busy;
   service_stat = end-service(end, s, l, 
is_service_error);
   /* Update partial reads and writes if any */
  -rec-s-readed += end-rd;
  -rec-s-transferred += end-wr;
  +if (p-worker-lbmethod == JK_LB_BYTRAFFIC) {
  +rec-s-readed += end-rd;
  +rec-s-transferred += end-wr;
  +}
   end-done(end, l);
   /* When returning the endpoint mark the worker as not 
busy.
* We have at least one endpoint free
  @@ -815,7 +842,7 @@
   }
   if (secret  (p-lb_workers[i].w-type == 
JK_AJP13_WORKER_TYPE ||
   p-lb_workers[i].w-type == JK_AJP14_WORKER_TYPE

cvs commit: jakarta-tomcat-connectors/jk/native/iis jk_isapi_plugin.c

2005-09-12 Thread mturk
mturk   2005/09/12 05:54:31

  Modified:jk/native/iis jk_isapi_plugin.c
  Log:
  Fix bug #36102 by using anon shared memory on windows.
  IIS can launch multiple child processes, so we need to share
  the date between them all.
  
  Revision  ChangesPath
  1.50  +3 -3  jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- jk_isapi_plugin.c 18 May 2005 18:04:53 -  1.49
  +++ jk_isapi_plugin.c 12 Sep 2005 12:54:31 -  1.50
  @@ -40,7 +40,7 @@
   #include jk_shm.h
   
   #define VERSION_STRING Jakarta/ISAPI/ JK_VERSTRING
  -
  +#define SHM_DEF_NAME   JKISAPISHMEM
   #define DEFAULT_WORKER_NAME (ajp13)
   /*
* We use special headers to pass values from the filter to the
  @@ -1117,7 +1117,7 @@
/* Simulate shared memory
 * For now use fixed size.
 */
  - jk_shm_open(NULL, JK_SHM_DEF_SIZE, logger);
  + jk_shm_open(SHM_DEF_NAME, JK_SHM_DEF_SIZE, logger);
   
/* 10 is minimum supported on WINXP */
jk_set_worker_def_cache_size(10);
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/xdocs changelog.xml

2005-09-12 Thread mturk
mturk   2005/09/12 05:58:24

  Modified:jk/xdocs changelog.xml
  Log:
  Update changelog
  
  Revision  ChangesPath
  1.37  +13 -0 jakarta-tomcat-connectors/jk/xdocs/changelog.xml
  
  Index: changelog.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/xdocs/changelog.xml,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- changelog.xml 5 Jul 2005 14:52:45 -   1.36
  +++ changelog.xml 12 Sep 2005 12:58:24 -  1.37
  @@ -21,6 +21,19 @@
 new documentation project for JK was started.
 /p
   /section
  +section name=Changes from the released JK 1.2.14
  +  br /
  +  subsection name=Native
  +changelog
  +  fix
  +  bug36102/bug: Worker actions do not persist. (mturk)
  +  /fix
  +  fix
  +  bug36525/bug: Solaris core dump. (murk)
  +  /fix
  +/changelog
  +  /subsection
  +/section
   section name=Changes from the released JK 1.2.13
 br /
 subsection name=Native
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_shm.h

2005-09-12 Thread mturk
mturk   2005/09/12 06:14:37

  Modified:jk/native/common jk_shm.h
  Log:
  Cleanup.
  
  Revision  ChangesPath
  1.24  +1 -3  jakarta-tomcat-connectors/jk/native/common/jk_shm.h
  
  Index: jk_shm.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_shm.h,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- jk_shm.h  12 Sep 2005 12:53:05 -  1.23
  +++ jk_shm.h  12 Sep 2005 13:14:37 -  1.24
  @@ -87,10 +87,8 @@
   volatile time_t  service_time;
   /* Number of bytes read from remote */
   volatile size_t readed;
  -volatile size_t rd;
   /* Number of bytes transferred to remote */
   volatile size_t transferred;
  -volatile size_t wr;
   /* Number of times the worker was elected */
   volatile size_t  elected;
   /* Number of non 200 responses */
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/apache-2.0 mod_jk.c

2005-09-12 Thread mturk
mturk   2005/09/12 06:26:07

  Modified:jk/native/apache-2.0 mod_jk.c
  Log:
  Fix #bug 35809. Patch provided by Christophe Dubach .
  
  Revision  ChangesPath
  1.153 +2 -2  jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
  
  Index: mod_jk.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
  retrieving revision 1.152
  retrieving revision 1.153
  diff -u -r1.152 -r1.153
  --- mod_jk.c  12 Jul 2005 19:17:42 -  1.152
  +++ mod_jk.c  12 Sep 2005 13:26:06 -  1.153
  @@ -2102,7 +2102,7 @@
   int i;
   for (i = 0; i  sz; i++) {
   const char *name = jk_map_name_at(src, i);
  -if (jk_map_get(src, name, NULL) == NULL) {
  +if (jk_map_get(dst, name, NULL) == NULL) {
   if (!jk_map_put(dst, name,
   apr_pstrdup(p, jk_map_get_string(src, name, 
NULL)),
   NULL)) {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/xdocs changelog.xml

2005-09-12 Thread mturk
mturk   2005/09/12 06:28:31

  Modified:jk/xdocs changelog.xml
  Log:
  Update changelog
  
  Revision  ChangesPath
  1.38  +4 -0  jakarta-tomcat-connectors/jk/xdocs/changelog.xml
  
  Index: changelog.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/xdocs/changelog.xml,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- changelog.xml 12 Sep 2005 12:58:24 -  1.37
  +++ changelog.xml 12 Sep 2005 13:28:31 -  1.38
  @@ -31,6 +31,10 @@
 fix
 bug36525/bug: Solaris core dump. (murk)
 /fix
  +  fix
  +  bug35809/bug: JkMountCopy don't work for Apache 2.0 Patch provided 
by
  +   Christophe Dubach. (mturk)
  +  /fix
   /changelog
 /subsection
   /section
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/xdocs changelog.xml

2005-09-12 Thread mturk
mturk   2005/09/12 06:46:01

  Modified:jk/native/iis jk_isapi_plugin.c
   jk/xdocs changelog.xml
  Log:
  Fix #35298. Patch provided by Tim Whittington.
  
  Revision  ChangesPath
  1.51  +22 -6 jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- jk_isapi_plugin.c 12 Sep 2005 12:54:31 -  1.50
  +++ jk_isapi_plugin.c 12 Sep 2005 13:46:00 -  1.51
  @@ -51,11 +51,22 @@
* 3. The contents of the Translate header, if any
*
*/
  -#define URI_HEADER_NAME  (TOMCATURI:)
  -#define QUERY_HEADER_NAME(TOMCATQUERY:)
  -#define WORKER_HEADER_NAME   (TOMCATWORKER:)
  -#define TOMCAT_TRANSLATE_HEADER_NAME (TOMCATTRANSLATE:)
  -#define CONTENT_LENGTH   (CONTENT_LENGTH:)
  +#define URI_HEADER_NAME_BASE (TOMCATURI)
  +#define QUERY_HEADER_NAME_BASE   (TOMCATQUERY)
  +#define WORKER_HEADER_NAME_BASE  (TOMCATWORKER)
  +#define TOMCAT_TRANSLATE_HEADER_NAME_BASE (TOMCATTRANSLATE)
  +
  +static char URI_HEADER_NAME[_MAX_FNAME];
  +static char QUERY_HEADER_NAME[_MAX_FNAME];
  +static char WORKER_HEADER_NAME[_MAX_FNAME];
  +static char TOMCAT_TRANSLATE_HEADER_NAME[_MAX_FNAME];
  +
  +/* The template used to construct our unique headers
  + * from the base name and module instance
  + */
  +#define HEADER_TEMPLATE (%s_%p:)
  +
  +#define CONTENT_LENGTH   (CONTENT_LENGTH)
   
   #define HTTP_URI_HEADER_NAME (HTTP_TOMCATURI)
   #define HTTP_QUERY_HEADER_NAME   (HTTP_TOMCATQUERY)
  @@ -1090,6 +1101,11 @@
   else {
   fReturn = JK_FALSE;
   }
  +/* Construct redirector headers to use for this redirector instance 
*/
  +sprintf(URI_HEADER_NAME, HEADER_TEMPLATE, URI_HEADER_NAME_BASE, 
hInst);
  +sprintf(QUERY_HEADER_NAME, HEADER_TEMPLATE, QUERY_HEADER_NAME_BASE, 
hInst);
  +sprintf(WORKER_HEADER_NAME, HEADER_TEMPLATE, 
WORKER_HEADER_NAME_BASE, hInst);
  +sprintf(TOMCAT_TRANSLATE_HEADER_NAME, HEADER_TEMPLATE, 
TOMCAT_TRANSLATE_HEADER_NAME_BASE, hInst);
   break;
   case DLL_PROCESS_DETACH:
   __try {
  
  
  
  1.39  +3 -0  jakarta-tomcat-connectors/jk/xdocs/changelog.xml
  
  Index: changelog.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/xdocs/changelog.xml,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- changelog.xml 12 Sep 2005 13:28:31 -  1.38
  +++ changelog.xml 12 Sep 2005 13:46:01 -  1.39
  @@ -35,6 +35,9 @@
 bug35809/bug: JkMountCopy don't work for Apache 2.0 Patch provided 
by
  Christophe Dubach. (mturk)
 /fix
  +  bug35298/bug: Multiple JK/ISAPI redirectors on a single IIS site 
are not supported
  +   Patch provided by Tim Whittington. (mturk)
  +  /fix
   /changelog
 /subsection
   /section
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/iis jk_isapi_plugin.c

2005-09-12 Thread mturk
mturk   2005/09/12 07:10:51

  Modified:jk/native/iis jk_isapi_plugin.c
  Log:
  Fix #35864 Status worker doesn't list workers
  Patch provided by   Martin Goldhahn
  
  Revision  ChangesPath
  1.52  +9 -6  jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- jk_isapi_plugin.c 12 Sep 2005 13:46:00 -  1.51
  +++ jk_isapi_plugin.c 12 Sep 2005 14:10:51 -  1.52
  @@ -133,6 +133,7 @@
   static int iis5 = -1;
   
   static jk_uri_worker_map_t *uw_map = NULL;
  +static jk_map_t *wp_map = NULL; /* worker_properties */
   static jk_logger_t *logger = NULL;
   static char *SERVER_NAME = SERVER_NAME;
   static char *SERVER_SOFTWARE = SERVER_SOFTWARE;
  @@ -1070,6 +1071,10 @@
   uri_worker_map_free(uw_map, logger);
   is_mapread = JK_FALSE;
   }
  +memset(worker_env, 0, sizeof(worker_env));
  +if (wp_map) {
  +jk_map_free(wp_map);
  +}
   wc_close(logger);
   if (logger) {
   jk_close_file_logger(logger);
  @@ -1125,7 +1130,6 @@
   static int init_jk(char *serverName)
   {
   int rc = JK_FALSE;
  -jk_map_t *map;
   
   if (!jk_open_file_logger(logger, log_file, log_level)) {
   logger = NULL;
  @@ -1164,14 +1168,14 @@
   }
   if (rc) {
   rc = JK_FALSE;
  -if (jk_map_alloc(map)) {
  -if (jk_map_read_properties(map, worker_file, NULL)) {
  +if (jk_map_alloc(wp_map)) {
  +if (jk_map_read_properties(wp_map, worker_file, NULL)) {
   /* we add the URI-WORKER MAP since workers using AJP14 will 
feed it */
   
   worker_env.uri_to_worker = uw_map;
   worker_env.server_name = serverName;
   
  -if (wc_open(map, worker_env, logger)) {
  +if (wc_open(wp_map, worker_env, logger)) {
   rc = JK_TRUE;
   }
   }
  @@ -1179,7 +1183,6 @@
   jk_log(logger, JK_LOG_EMERG,
  Unable to read worker file %s., worker_file);
   }
  -jk_map_free(map);
   }
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/iis/installer isapi-redirector-win32-msi.ism

2005-09-12 Thread mturk
mturk   2005/09/12 07:15:45

  Modified:jk/native/iis/installer isapi-redirector-win32-msi.ism
  Log:
  Bump version.
  
  Revision  ChangesPath
  1.11  +1 -1  
jakarta-tomcat-connectors/jk/native/iis/installer/isapi-redirector-win32-msi.ism
  
  Index: isapi-redirector-win32-msi.ism
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/iis/installer/isapi-redirector-win32-msi.ism,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- isapi-redirector-win32-msi.ism16 May 2005 08:13:39 -  1.10
  +++ isapi-redirector-win32-msi.ism12 Sep 2005 14:15:44 -  1.11
  @@ -3288,7 +3288,7 @@
rowtdProductID/tdtdnone/tdtd//row
rowtdProductLanguage/tdtd1033/tdtd//row
rowtdProductName/tdtdJakarta Isapi 
Redirector/tdtd//row
  - rowtdProductVersion/tdtd1.2.14/tdtd//row
  + rowtdProductVersion/tdtd1.2.15/tdtd//row
rowtdProgressType0/tdtdinstall/tdtd//row
rowtdProgressType1/tdtdInstalling/tdtd//row
rowtdProgressType2/tdtdinstalled/tdtd//row
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/xdocs changelog.xml

2005-09-12 Thread mturk
mturk   2005/09/12 07:29:49

  Modified:jk/xdocs changelog.xml
  Log:
  Update changelog.
  
  Revision  ChangesPath
  1.41  +5 -1  jakarta-tomcat-connectors/jk/xdocs/changelog.xml
  
  Index: changelog.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/xdocs/changelog.xml,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- changelog.xml 12 Sep 2005 13:54:44 -  1.40
  +++ changelog.xml 12 Sep 2005 14:29:49 -  1.41
  @@ -26,10 +26,14 @@
 subsection name=Native
   changelog
 fix
  +  bug36525/bug: Solaris core dump. (mturk)
  +  /fix
  +  fix
 bug36102/bug: Worker actions do not persist. (mturk)
 /fix
 fix
  -  bug36525/bug: Solaris core dump. (murk)
  +  bug35864/bug: Status worker doesn't list workers.
  +  Patch provided by Martin Goldhahn. (mturk)
 /fix
 fix
 bug35809/bug: JkMountCopy don't work for Apache 2.0 Patch provided 
by
  
  
  

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



cvs commit: jakarta-tomcat-5 tomcat.nsi

2005-08-04 Thread mturk
mturk   2005/08/03 23:52:35

  Modified:.tomcat.nsi
  Log:
  Use tomcat vhost from heanet.
  
  Revision  ChangesPath
  1.82  +3 -3  jakarta-tomcat-5/tomcat.nsi
  
  Index: tomcat.nsi
  ===
  RCS file: /home/cvs/jakarta-tomcat-5/tomcat.nsi,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- tomcat.nsi3 Aug 2005 08:22:39 -   1.81
  +++ tomcat.nsi4 Aug 2005 06:52:35 -   1.82
  @@ -203,11 +203,11 @@
   
 SectionIn 3
   
  -  NSISdl::download /TIMEOUT=3 
http://ftp.heanet.ie/pub/tomcat/native/1.1.0/binaries/win32/tcnative-1.dll 
$INSTDIR\bin\tcnative-1.dll
  +  NSISdl::download /TIMEOUT=3 
http://tomcat.heanet.ie/native/1.1.0/binaries/win32/tcnative-1.dll 
$INSTDIR\bin\tcnative-1.dll
 Pop $0
 StrCmp $0 success success
   SetDetailsView show
  -DetailPrint download failed from 
http://ftp.heanet.ie/pub/tomcat/native/1.1.0/binaries/win32/tcnative-1.dll: $0
  +DetailPrint download failed from 
http://tomcat.heanet.ie/native/1.1.0/binaries/win32/tcnative-1.dll: $0
 success:
   
 ClearErrors
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni jnirelease.sh

2005-08-02 Thread mturk
mturk   2005/08/02 03:13:38

  Added:   jni  jnirelease.sh
  Log:
  Initial implementation for tomcat-native release script.
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-connectors/jni/jnirelease.sh
  
  Index: jnirelease.sh
  ===
  #/bin/sh
  #
  # Copyright 1999-2005 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the License);
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an AS IS BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # Replace JKJNITAG with real tag, like TOMCAT_NATIVE_1_1_0
  JKJNITAG=HEAD
  # Replace JKJNIEXT with tagged version number, like 1.1.0
  JKJNIEXT=current
  JKJNIVER=-${JKJNIEXT}
  JKJNICVST=jakarta-tomcat-connectors
  export CVSROOT=:pserver:[EMAIL PROTECTED]:/home/cvspublic
  JKJNIDIST=tomcat-native${JKJNIVER}
  rm -rf ${JKJNIDIST}
  rm -f ${JKJNIDIST}.*
  cvs export -N -r $JKJNITAG jakarta-tomcat-connectors/KEYS
  cvs export -N -r $JKJNITAG jakarta-tomcat-connectors/LICENSE
  cvs export -N -r $JKJNITAG jakarta-tomcat-connectors/NOTICE
  cvs export -N -r $JKJNITAG jakarta-tomcat-connectors/jni/NOTICE.txt
  cvs export -N -r $JKJNITAG jakarta-tomcat-connectors/jni/README.txt
  cvs export -N -r $JKJNITAG jakarta-tomcat-connectors/jni/native
  mv ${JKJNICVST} ${JKJNIDIST}
  
  # Prebuild
  cd ${JKJNIDIST}/jni/native
  # Adjust the location of APR sources
  ./buildconf --with-apr=../../../srclib/apr
  cd ../../../
  # Create distribution
  tar cvf ${JKJNIDIST}.tar ${JKJNIDIST}
  gzip ${JKJNIDIST}.tar
  # Convert lineends to DOS
  ./srclib/apr/lineends.pl --cr ${JKJNIDIST}
  zip -9 -r  %JKJNIDIST%.zip %JKJNIDIST%
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni jnirelease.sh

2005-08-02 Thread mturk
mturk   2005/08/02 03:15:55

  Modified:jni  jnirelease.sh
  Log:
  Fix copy/paste from WIN batch script.
  
  Revision  ChangesPath
  1.2   +1 -1  jakarta-tomcat-connectors/jni/jnirelease.sh
  
  Index: jnirelease.sh
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/jnirelease.sh,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jnirelease.sh 2 Aug 2005 10:13:38 -   1.1
  +++ jnirelease.sh 2 Aug 2005 10:15:55 -   1.2
  @@ -42,4 +42,4 @@
   gzip ${JKJNIDIST}.tar
   # Convert lineends to DOS
   ./srclib/apr/lineends.pl --cr ${JKJNIDIST}
  -zip -9 -r  %JKJNIDIST%.zip %JKJNIDIST%
  +zip -9 -r  ${JKJNIDIST}.zip ${JKJNIDIST}
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native configure.in

2005-08-02 Thread mturk
mturk   2005/08/02 04:33:11

  Modified:jni/native configure.in
  Log:
  Link with libkstat for Solaris
  
  Revision  ChangesPath
  1.9   +9 -0  jakarta-tomcat-connectors/jni/native/configure.in
  
  Index: configure.in
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/configure.in,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- configure.in  23 Jun 2005 14:49:36 -  1.8
  +++ configure.in  2 Aug 2005 11:33:11 -   1.9
  @@ -150,6 +150,15 @@
   APR_ADDTO(TCNATIVE_LIBS, [$APR_LIBS])
   APR_ADDTO(TCNATIVE_LDFLAGS, [$LDFLAGS])
   
  +# Link libkstat for Solaris
  +case $host in
  +*-solaris2*)
  +APR_ADDTO(TCNATIVE_LIBS, -lkstat)
  +;;
  +*)
  +;;
  +esac
  +
   AC_SUBST(TCNATIVE_EXPORT_LIBS)
   AC_SUBST(TCNATIVE_PRIV_INCLUDES)
   AC_SUBST(TCNATIVE_INCLUDES)
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni jnirelease.sh

2005-08-02 Thread mturk
mturk   2005/08/02 07:15:58

  Modified:jni  jnirelease.sh
  Log:
  lineends.pl is not executable so use perl.
  
  Revision  ChangesPath
  1.3   +1 -1  jakarta-tomcat-connectors/jni/jnirelease.sh
  
  Index: jnirelease.sh
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/jnirelease.sh,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- jnirelease.sh 2 Aug 2005 10:15:55 -   1.2
  +++ jnirelease.sh 2 Aug 2005 14:15:58 -   1.3
  @@ -41,5 +41,5 @@
   tar cvf ${JKJNIDIST}.tar ${JKJNIDIST}
   gzip ${JKJNIDIST}.tar
   # Convert lineends to DOS
  -./srclib/apr/lineends.pl --cr ${JKJNIDIST}
  +perl srclib/apr/lineends.pl --cr ${JKJNIDIST}
   zip -9 -r  ${JKJNIDIST}.zip ${JKJNIDIST}
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni jnirelease.sh

2005-08-02 Thread mturk
mturk   2005/08/02 07:21:23

  Modified:jni  jnirelease.sh
  Log:
  Fix path to the lineends.pl
  
  Revision  ChangesPath
  1.4   +1 -1  jakarta-tomcat-connectors/jni/jnirelease.sh
  
  Index: jnirelease.sh
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/jnirelease.sh,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- jnirelease.sh 2 Aug 2005 14:15:58 -   1.3
  +++ jnirelease.sh 2 Aug 2005 14:21:23 -   1.4
  @@ -41,5 +41,5 @@
   tar cvf ${JKJNIDIST}.tar ${JKJNIDIST}
   gzip ${JKJNIDIST}.tar
   # Convert lineends to DOS
  -perl srclib/apr/lineends.pl --cr ${JKJNIDIST}
  +perl srclib/apr/build/lineends.pl --cr ${JKJNIDIST}
   zip -9 -r  ${JKJNIDIST}.zip ${JKJNIDIST}
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/os/win32 system.c

2005-08-01 Thread mturk
mturk   2005/07/31 23:34:33

  Modified:jni/java/org/apache/tomcat/jni OS.java
   jni/native/os/unix system.c
   jni/native/os/win32 system.c
  Log:
  Implement Solaris system info. Patches provided by Rainer Jung.
  
  Revision  ChangesPath
  1.8   +2 -2  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/OS.java
  
  Index: OS.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/OS.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- OS.java   12 Jul 2005 14:56:09 -  1.7
  +++ OS.java   1 Aug 2005 06:34:32 -   1.8
  @@ -91,7 +91,7 @@
* inf[6]  - Memory Load
*
* inf[7]  - Idle Time in microseconds
  - * inf[9]  - Kernel Time in microseconds
  + * inf[8]  - Kernel Time in microseconds
* inf[9]  - User Time in microseconds
*
* inf[10] - Process creation time (apr_time_t)
  
  
  
  1.9   +189 -1jakarta-tomcat-connectors/jni/native/os/unix/system.c
  
  Index: system.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/unix/system.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- system.c  12 Jul 2005 14:56:11 -  1.8
  +++ system.c  1 Aug 2005 06:34:33 -   1.9
  @@ -27,6 +27,42 @@
   #include tcn.h
   #if defined(__linux__)
   #include sys/sysinfo.h
  +#elif defined(sun)
  +#include unistd.h
  +#include sys/swap.h
  +#include procfs.h
  +#include kstat.h
  +#include sys/sysinfo.h
  +#endif
  +
  +#if defined(sun)
  +#define MAX_PROC_PATH_LEN 64
  +#define MAX_CPUS 512
  +// #define PSTATUS_T_SZ sizeof(pstatus_t)
  +#define PSINFO_T_SZ sizeof(psinfo_t)
  +#define PRUSAGE_T_SZ sizeof(prusage_t)
  +
  +static int proc_open(const char *type) {
  +char proc_path[MAX_PROC_PATH_LEN+1];
  +
  +sprintf(proc_path,/proc/self/%s,type);
  +return open(proc_path, O_RDONLY);
  +} // end proc_open
  +
  +static int proc_read(void *buf, const size_t size, int filedes) {
  +ssize_t bytes;
  +
  +if ( filedes = 0 ) {
  +bytes = pread(filedes, buf, size, 0);
  +if ( bytes != size ) {
  +return -1;
  +}
  +} else {
  +return -1;
  +}
  +return 0;
  +} // end proc_read
  +
   #endif
   
   TCN_IMPLEMENT_CALL(jboolean, OS, is)(TCN_STDARGS, jint type)
  @@ -80,6 +116,158 @@
   rv = APR_SUCCESS;
   }
   }
  +#elif defined(sun)
  +{
  +/* static variables with basic procfs info */
  +static long creation = 0;  /* unix timestamp of process 
creation */
  +static int psinf_fd = 0;   /* file descriptor for the 
psinfo procfs file */
  +static int prusg_fd = 0;   /* file descriptor for the 
usage procfs file */
  +static size_t rss=0;   /* maximum of resident set 
size from previous calls */
  +/* static variables with basic kstat info */
  +static kstat_ctl_t *kstat_ctl = NULL;  /* kstat control object, only 
initialized once */
  +static kstat_t *kstat_cpu[MAX_CPUS];   /* array of kstat objects for 
per cpu statistics */
  +static int cpu_count=0;/* number of cpu structures 
found in kstat */
  +static kid_t kid=0;/* kstat ID, for which the 
kstat_ctl holds the correct chain */
  +/* non-static variables - general use */
  +int res=0; /* general result state */
  +/* non-static variables - sysinfo/swapctl use */
  +long ret_sysconf;  /* value returned from 
sysconf call */
  +long tck_dividend; /* factor used by 
transforming tick numbers to milliseconds */
  +long tck_divisor;  /* divisor used by 
transforming tick numbers to milliseconds */
  +long sys_pagesize=sysconf(_SC_PAGESIZE); /* size of a system memory 
page in bytes */
  +long sys_clk_tck=sysconf(_SC_CLK_TCK); /* number of system ticks per 
second */
  +struct anoninfo info;  /* structure for information 
about sizes in anonymous memory system */
  +/* non-static variables - procfs use */
  +psinfo_t psinf;/* psinfo structure from 
procfs */
  +prusage_t prusg;   /* usage structure from 
procfs */
  +size_t new_rss=0;  /* resident set size read 
from procfs */
  +time_t now;/* time needed for 
calculating process creation time */
  +/* non-static variables - kstat use */
  +kstat_t *kstat = NULL; /* kstat working pointer */
  +cpu_sysinfo_t cpu; /* cpu sysinfo working 
pointer */
  +kid_t

cvs commit: jakarta-tomcat-connectors/jni/native/os/unix system.c

2005-08-01 Thread mturk
mturk   2005/07/31 23:49:53

  Modified:jni/native/os/unix system.c
  Log:
  Indent source code. No functional change.
  
  Revision  ChangesPath
  1.10  +91 -81jakarta-tomcat-connectors/jni/native/os/unix/system.c
  
  Index: system.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/unix/system.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- system.c  1 Aug 2005 06:34:33 -   1.9
  +++ system.c  1 Aug 2005 06:49:53 -   1.10
  @@ -38,30 +38,31 @@
   #if defined(sun)
   #define MAX_PROC_PATH_LEN 64
   #define MAX_CPUS 512
  -// #define PSTATUS_T_SZ sizeof(pstatus_t)
   #define PSINFO_T_SZ sizeof(psinfo_t)
   #define PRUSAGE_T_SZ sizeof(prusage_t)
   
  -static int proc_open(const char *type) {
  +static int proc_open(const char *type)
  +{
   char proc_path[MAX_PROC_PATH_LEN+1];
   
  -sprintf(proc_path,/proc/self/%s,type);
  +sprintf(proc_path, /proc/self/%s, type);
   return open(proc_path, O_RDONLY);
  -} // end proc_open
  +}
   
  -static int proc_read(void *buf, const size_t size, int filedes) {
  +static int proc_read(void *buf, const size_t size, int filedes)
  +{
   ssize_t bytes;
   
  -if ( filedes = 0 ) {
  +if (filedes = 0) {
   bytes = pread(filedes, buf, size, 0);
  -if ( bytes != size ) {
  +if (bytes != size)
   return -1;
  -}
  -} else {
  -return -1;
  +else
  +return 0;
   }
  -return 0;
  -} // end proc_read
  +else
  +return -1;
  +}
   
   #endif
   
  @@ -118,155 +119,164 @@
   }
   #elif defined(sun)
   {
  -/* static variables with basic procfs info */
  +/* static variables with basic procfs info */
   static long creation = 0;  /* unix timestamp of process 
creation */
   static int psinf_fd = 0;   /* file descriptor for the 
psinfo procfs file */
   static int prusg_fd = 0;   /* file descriptor for the 
usage procfs file */
  -static size_t rss=0;   /* maximum of resident set 
size from previous calls */
  -/* static variables with basic kstat info */
  +static size_t rss = 0; /* maximum of resident set 
size from previous calls */
  +/* static variables with basic kstat info */
   static kstat_ctl_t *kstat_ctl = NULL;  /* kstat control object, only 
initialized once */
   static kstat_t *kstat_cpu[MAX_CPUS];   /* array of kstat objects for 
per cpu statistics */
  -static int cpu_count=0;/* number of cpu structures 
found in kstat */
  -static kid_t kid=0;/* kstat ID, for which the 
kstat_ctl holds the correct chain */
  -/* non-static variables - general use */
  -int res=0; /* general result state */
  -/* non-static variables - sysinfo/swapctl use */
  +static int cpu_count = 0;  /* number of cpu structures 
found in kstat */
  +static kid_t kid = 0;  /* kstat ID, for which the 
kstat_ctl holds the correct chain */
  +/* non-static variables - general use */
  +int res = 0;   /* general result state */
  +/* non-static variables - sysinfo/swapctl use */
   long ret_sysconf;  /* value returned from 
sysconf call */
   long tck_dividend; /* factor used by 
transforming tick numbers to milliseconds */
   long tck_divisor;  /* divisor used by 
transforming tick numbers to milliseconds */
  -long sys_pagesize=sysconf(_SC_PAGESIZE); /* size of a system memory 
page in bytes */
  -long sys_clk_tck=sysconf(_SC_CLK_TCK); /* number of system ticks per 
second */
  +long sys_pagesize = sysconf(_SC_PAGESIZE); /* size of a system 
memory page in bytes */
  +long sys_clk_tck = sysconf(_SC_CLK_TCK); /* number of system ticks 
per second */
   struct anoninfo info;  /* structure for information 
about sizes in anonymous memory system */
  -/* non-static variables - procfs use */
  +/* non-static variables - procfs use */
   psinfo_t psinf;/* psinfo structure from 
procfs */
   prusage_t prusg;   /* usage structure from 
procfs */
  -size_t new_rss=0;  /* resident set size read 
from procfs */
  +size_t new_rss = 0;/* resident set size read 
from procfs */
   time_t now;/* time needed for 
calculating process creation time */
  -/* non-static variables - kstat use */
  +/* non-static variables - kstat use */
   kstat_t *kstat = NULL; /* kstat working pointer

cvs commit: jakarta-tomcat-connectors/jni/native/src file.c

2005-08-01 Thread mturk
mturk   2005/07/31 23:59:48

  Modified:jni/native/src file.c
  Log:
  Use the proper APR function for dup2.
  
  Revision  ChangesPath
  1.10  +2 -2  jakarta-tomcat-connectors/jni/native/src/file.c
  
  Index: file.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/file.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- file.c12 Jul 2005 14:56:11 -  1.9
  +++ file.c1 Aug 2005 06:59:48 -   1.10
  @@ -597,7 +597,7 @@
   apr_file_t *d = J2P(newf, apr_file_t *);
   
   UNREFERENCED(o);
  -TCN_THROW_IF_ERR(apr_file_dup(d, f, p), d);
  +TCN_THROW_IF_ERR(apr_file_dup2(d, f, p), d);
   
   cleanup:
   return P2J(d);
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src file.c

2005-08-01 Thread mturk
mturk   2005/08/01 00:08:55

  Modified:jni/java/org/apache/tomcat/jni File.java
   jni/native/src file.c
  Log:
  Fix dup2 implementation.
  
  Revision  ChangesPath
  1.7   +4 -5  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/File.java
  
  Index: File.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/File.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- File.java 12 Jul 2005 14:56:09 -  1.6
  +++ File.java 1 Aug 2005 07:08:55 -   1.7
  @@ -671,15 +671,14 @@
   throws Error;
   
   /**
  - * Duplicate the specified file descriptor.
  + * Duplicate the specified file descriptor and close the original.
* @param newFile The old file that is to be closed and reused.
* newFile MUST point at a valid apr_file_t. It cannot be NULL.
* @param oldFile The file to duplicate.
* @param pool The pool to use for the new file.
  - * @return Duplicated file structure.
  + * @return Status code.
*/
  -public static native long dup2(long newFile, long oldFile, long pool)
  -throws Error;
  +public static native int dup2(long newFile, long oldFile, long pool)
   
   /**
* Get the specified file's stats.  The file is specified by filename,
  
  
  
  1.11  +5 -8  jakarta-tomcat-connectors/jni/native/src/file.c
  
  Index: file.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/file.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- file.c1 Aug 2005 06:59:48 -   1.10
  +++ file.c1 Aug 2005 07:08:55 -   1.11
  @@ -589,16 +589,13 @@
   return P2J(d);
   }
   
  -TCN_IMPLEMENT_CALL(jlong, File, dup2)(TCN_STDARGS, jlong newf, jlong file,
  -  jlong pool)
  +TCN_IMPLEMENT_CALL(jint, File, dup2)(TCN_STDARGS, jlong newf, jlong file,
  + jlong pool)
   {
   apr_file_t *f = J2P(file, apr_file_t *);
   apr_pool_t *p = J2P(pool, apr_pool_t *);
   apr_file_t *d = J2P(newf, apr_file_t *);
   
  -UNREFERENCED(o);
  -TCN_THROW_IF_ERR(apr_file_dup2(d, f, p), d);
  -
  -cleanup:
  -return P2J(d);
  +UNREFERENCED_STDARGS;
  +return (jint)apr_file_dup2(d, f, p);
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni File.java

2005-08-01 Thread mturk
mturk   2005/08/01 00:09:39

  Modified:jni/java/org/apache/tomcat/jni File.java
  Log:
  Fix typo in dup2 prototype.
  
  Revision  ChangesPath
  1.8   +2 -2  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/File.java
  
  Index: File.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/File.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- File.java 1 Aug 2005 07:08:55 -   1.7
  +++ File.java 1 Aug 2005 07:09:39 -   1.8
  @@ -678,7 +678,7 @@
* @param pool The pool to use for the new file.
* @return Status code.
*/
  -public static native int dup2(long newFile, long oldFile, long pool)
  +public static native int dup2(long newFile, long oldFile, long pool);
   
   /**
* Get the specified file's stats.  The file is specified by filename,
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-08-01 Thread mturk
mturk   2005/08/01 00:12:55

  Modified:jni/native/src sslinfo.c
  Log:
  Remove unused value declaration.
  
  Revision  ChangesPath
  1.12  +1 -2  jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- sslinfo.c 12 Jul 2005 14:56:11 -  1.11
  +++ sslinfo.c 1 Aug 2005 07:12:55 -   1.12
  @@ -523,7 +523,6 @@
   break;
   case SSL_INFO_CLIENT_CERT_CHAIN:
   {
  -X509 *xs;
   STACK_OF(X509) *sk =  SSL_get_peer_cert_chain(s-ssl);
   value = sk_X509_num(sk);
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-08-01 Thread mturk
mturk   2005/08/01 00:23:10

  Modified:jni/java/org/apache/tomcat/jni SSL.java
   jni/native/include ssl_private.h
   jni/native/src sslinfo.c
  Log:
  Implement SSL_INFO_CLIENT_V_REMAIN cert info flag and call.
  
  Revision  ChangesPath
  1.23  +2 -1  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSL.java
  
  Index: SSL.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSL.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SSL.java  12 Jul 2005 14:56:09 -  1.22
  +++ SSL.java  1 Aug 2005 07:23:09 -   1.23
  @@ -195,6 +195,7 @@
   public static final int SSL_INFO_CLIENT_A_SIG  = 0x0105;
   public static final int SSL_INFO_CLIENT_A_KEY  = 0x0106;
   public static final int SSL_INFO_CLIENT_CERT   = 0x0107;
  +public static final int SSL_INFO_CLIENT_V_REMAIN   = 0x0108;
   
   public static final int SSL_INFO_SERVER_M_VERSION  = 0x0201;
   public static final int SSL_INFO_SERVER_M_SERIAL   = 0x0202;
  
  
  
  1.35  +2 -1  
jakarta-tomcat-connectors/jni/native/include/ssl_private.h
  
  Index: ssl_private.h
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/native/include/ssl_private.h,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- ssl_private.h 12 Jul 2005 14:56:10 -  1.34
  +++ ssl_private.h 1 Aug 2005 07:23:09 -   1.35
  @@ -178,6 +178,7 @@
   #define SSL_INFO_CLIENT_A_SIG   (0x0105)
   #define SSL_INFO_CLIENT_A_KEY   (0x0106)
   #define SSL_INFO_CLIENT_CERT(0x0107)
  +#define SSL_INFO_CLIENT_V_REMAIN(0x0108)
   
   #define SSL_INFO_SERVER_MASK(0x0200)
   
  
  
  
  1.13  +19 -2 jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- sslinfo.c 1 Aug 2005 07:12:55 -   1.12
  +++ sslinfo.c 1 Aug 2005 07:23:09 -   1.13
  @@ -498,6 +498,7 @@
   {
   tcn_socket_t   *a = J2P(sock, tcn_socket_t *);
   tcn_ssl_conn_t *s;
  +apr_status_t rv = APR_SUCCESS;
   jint value = -1;
   
   UNREFERENCED(o);
  @@ -528,10 +529,26 @@
   }
   break;
   default:
  -tcn_ThrowAPRException(e, APR_EINVAL);
  +rv = APR_EINVAL;
   break;
   }
  +if (what  SSL_INFO_CLIENT_MASK) {
  +X509 *xs;
  +if ((xs = SSL_get_peer_certificate(s-ssl)) != NULL) {
  +switch (what) {
  +case SSL_INFO_CLIENT_V_REMAIN:
  +value = get_days_remaining(X509_get_notAfter(xs));
  +rv = APR_SUCCESS;
  +break;
  +default:
  +rv = APR_EINVAL;
  +break;
  +   }
  +}
  +}
   
  +if (rv != APR_SUCCESS)
  +tcn_ThrowAPRException(e, rv);
   return value;
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-08-01 Thread mturk
mturk   2005/08/01 00:27:59

  Modified:jni/native/src sslinfo.c
  Log:
  Release X509 certificate to supress the mem leak.
  
  Revision  ChangesPath
  1.14  +2 -1  jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- sslinfo.c 1 Aug 2005 07:23:09 -   1.13
  +++ sslinfo.c 1 Aug 2005 07:27:59 -   1.14
  @@ -544,6 +544,7 @@
   rv = APR_EINVAL;
   break;
  }
  +   X509_free(xs);
   }
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src ssl.c

2005-08-01 Thread mturk
mturk   2005/08/01 06:07:54

  Modified:jni/native/src ssl.c
  Log:
  Check if we have OpenSSL = 0.9.7
  
  Revision  ChangesPath
  1.39  +5 -1  jakarta-tomcat-connectors/jni/native/src/ssl.c
  
  Index: ssl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/ssl.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- ssl.c 12 Jul 2005 14:56:11 -  1.38
  +++ ssl.c 1 Aug 2005 13:07:54 -   1.39
  @@ -369,6 +369,10 @@
   TCN_FREE_CSTRING(engine);
   return (jint)APR_SUCCESS;
   }
  +if (SSLeay()  0x0090700L) {
  +TCN_FREE_CSTRING(engine);
  +return (jint)APR_EINVAL;
  +}
   /* We must register the library in full, to ensure our configuration
* code can successfully test the SSL environment.
*/
  
  
  

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



cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net AprEndpoint.java

2005-07-16 Thread mturk
mturk   2005/07/16 05:11:11

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Add APR_SO_REUSEADDR and APR_SO_KEEPALIVE to the listening
  socket. This resolves 'address in use exception', and is the way how
  the Apache HTTPD is using the APR.
  See the: server/listen.c
  
  Revision  ChangesPath
  1.66  +8 -0  
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.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- AprEndpoint.java  15 Jul 2005 15:40:00 -  1.65
  +++ AprEndpoint.java  16 Jul 2005 12:11:11 -  1.66
  @@ -24,6 +24,7 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.tomcat.jni.OS;
   import org.apache.tomcat.jni.Address;
   import org.apache.tomcat.jni.Error;
   import org.apache.tomcat.jni.File;
  @@ -511,6 +512,9 @@
   // Create the APR server socket
   serverSock = Socket.create(Socket.APR_INET, Socket.SOCK_STREAM,
   Socket.APR_PROTO_TCP, rootPool);
  +if (OS.IS_UNIX) {
  +Socket.optSet(serverSock, Socket.APR_SO_REUSEADDR, 1);
  +}
   // Bind the server socket
   int ret = Socket.bind(serverSock, inetAddress);
   if (ret != 0) {
  @@ -521,6 +525,10 @@
   if (ret != 0) {
   throw new Exception(sm.getString(endpoint.init.listen,  + 
ret));
   }
  +if (OS.IS_WIN32 || OS.IS_WIN64) {
  +// On Windows set the reuseaddr flag after the bind/listen
  +Socket.optSet(serverSock, Socket.APR_SO_REUSEADDR, 1);
  +}
   
   // Sendfile usage on systems which don't support it cause major 
problems
   if (useSendfile  !Library.APR_HAS_SENDFILE) {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net AprEndpoint.java

2005-07-16 Thread mturk
mturk   2005/07/16 05:22:42

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Add a missing SO_KEEPALIVE option.
  See the previous commit for an explanation.
  
  Revision  ChangesPath
  1.67  +2 -0  
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.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- AprEndpoint.java  16 Jul 2005 12:11:11 -  1.66
  +++ AprEndpoint.java  16 Jul 2005 12:22:42 -  1.67
  @@ -515,6 +515,8 @@
   if (OS.IS_UNIX) {
   Socket.optSet(serverSock, Socket.APR_SO_REUSEADDR, 1);
   }
  +// Deal with the firewalls that tend to drop the inactive sockets
  +Socket.optSet(serverSock, Socket.APR_SO_KEEPALIVE, 1);
   // Bind the server socket
   int ret = Socket.bind(serverSock, inetAddress);
   if (ret != 0) {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/examples mkcerts

2005-07-13 Thread mturk
mturk   2005/07/13 11:29:58

  Modified:jni/examples mkcerts
  Log:
  Crete PKCS12 demo user certificate for using with Web browser
  to test the Client Authentication.
  
  Revision  ChangesPath
  1.3   +3 -0  jakarta-tomcat-connectors/jni/examples/mkcerts
  
  Index: mkcerts
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/examples/mkcerts,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mkcerts   7 Jul 2005 09:14:14 -   1.2
  +++ mkcerts   13 Jul 2005 18:29:58 -  1.3
  @@ -204,6 +204,9 @@
   # $OPENSSL verify -CAfile ca.crt localhost.crt
   # $OPENSSL verify -CAfile ca.crt user.crt
   
  +# Create PKCS12 user certificate
  +$OPENSSL pkcs12 -export -passout $PASSPHRASE -passin $PASSPHRASE -in 
user.crt -inkey user.key -certfile ca.crt -out user.p12
  +
   rm -f ca.cfg
   rm -f ca.serial.old
   rm -f ca.index.old
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-07-12 Thread mturk
mturk   2005/07/12 06:28:57

  Modified:jni/native/src sslinfo.c
  Log:
  Socket used is abstract socket not the SSL opaque.
  
  Revision  ChangesPath
  1.7   +11 -4 jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- sslinfo.c 8 Jul 2005 07:49:56 -   1.6
  +++ sslinfo.c 12 Jul 2005 13:28:57 -  1.7
  @@ -203,13 +203,15 @@
   TCN_IMPLEMENT_CALL(jobject, SSLSocket, getInfoB)(TCN_STDARGS, jlong sock,
jint what)
   {
  -tcn_ssl_conn_t *s = J2P(sock, tcn_ssl_conn_t *);
  +tcn_socket_t   *a = J2P(sock, tcn_socket_t *);
  +tcn_ssl_conn_t *s;
   jbyteArray array = NULL;
   apr_status_t rv = APR_SUCCESS;
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
   
  +s = (tcn_ssl_conn_t *)(a-opaque);
   switch (what) {
   case SSL_INFO_SESSION_ID:
   {
  @@ -281,13 +283,15 @@
   TCN_IMPLEMENT_CALL(jstring, SSLSocket, getInfoS)(TCN_STDARGS, jlong sock,
jint what)
   {
  -tcn_ssl_conn_t *s = J2P(sock, tcn_ssl_conn_t *);
  +tcn_socket_t   *a = J2P(sock, tcn_socket_t *);
  +tcn_ssl_conn_t *s;
   jstring value = NULL;
   apr_status_t rv = APR_SUCCESS;
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
   
  +s = (tcn_ssl_conn_t *)(a-opaque);
   switch (what) {
   case SSL_INFO_SESSION_ID:
   {
  @@ -491,12 +495,15 @@
   TCN_IMPLEMENT_CALL(jint, SSLSocket, getInfoI)(TCN_STDARGS, jlong sock,
 jint what)
   {
  -tcn_ssl_conn_t *s = J2P(sock, tcn_ssl_conn_t *);
  +tcn_socket_t   *a = J2P(sock, tcn_socket_t *);
  +tcn_ssl_conn_t *s;
   jint value = -1;
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
   
  +s = (tcn_ssl_conn_t *)(a-opaque);
  +
   switch (what) {
   case SSL_INFO_CIPHER_USEKEYSIZE:
   case SSL_INFO_CIPHER_ALGKEYSIZE:
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-07-12 Thread mturk
mturk   2005/07/12 06:38:38

  Modified:jni/native/src sslinfo.c
  Log:
  Set the rv to APR_SUCCESS if the CERT_CHAIN is valid
  
  Revision  ChangesPath
  1.8   +2 -1  jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- sslinfo.c 12 Jul 2005 13:28:57 -  1.7
  +++ sslinfo.c 12 Jul 2005 13:38:38 -  1.8
  @@ -485,6 +485,7 @@
   free(result);
   }
   }
  +rv = APR_SUCCESS;
   }
   if (rv != APR_SUCCESS)
   tcn_ThrowAPRException(e, rv);
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-07-12 Thread mturk
mturk   2005/07/12 06:43:59

  Modified:jni/native/src sslinfo.c
  Log:
  Throw the exception if rv != APR_SUCCESS
  
  Revision  ChangesPath
  1.9   +1 -1  jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- sslinfo.c 12 Jul 2005 13:38:38 -  1.8
  +++ sslinfo.c 12 Jul 2005 13:43:59 -  1.9
  @@ -223,7 +223,7 @@
   }
   break;
   default:
  -tcn_ThrowAPRException(e, APR_EINVAL);
  +rv = APR_EINVAL;
   break;
   }
   if (what  SSL_INFO_CLIENT_MASK) {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-07-12 Thread mturk
mturk   2005/07/12 06:58:49

  Modified:jni/native/src sslinfo.c
  Log:
  Get int param for obtaining the number of certificates in the chain,
  so that we don't rely on the first exception for getting the certificate.
  
  Revision  ChangesPath
  1.10  +8 -1  jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- sslinfo.c 12 Jul 2005 13:43:59 -  1.9
  +++ sslinfo.c 12 Jul 2005 13:58:49 -  1.10
  @@ -521,6 +521,13 @@
   }
   }
   break;
  +case SSL_INFO_CLIENT_CERT_CHAIN:
  +{
  +X509 *xs;
  +STACK_OF(X509) *sk =  SSL_get_peer_cert_chain(s-ssl);
  +value = sk_X509_num(sk);
  +}
  +break;
   default:
   tcn_ThrowAPRException(e, APR_EINVAL);
   break;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src dir.c error.c file.c info.c jnilib.c lock.c misc.c mmap.c network.c os.c poll.c pool.c proc.c shm.c ssl.c sslcontext.c sslinfo.c sslnetwork.c sslutils.c stdlib.c user.c

2005-07-12 Thread mturk
mturk   2005/07/12 07:56:12

  Modified:jni/examples/org/apache/tomcat/jni Echo.java
   jni/java/org/apache/tomcat Apr.java
   jni/java/org/apache/tomcat/jni Address.java BIOCallback.java
Directory.java Error.java File.java FileInfo.java
Global.java Library.java Local.java Lock.java
Mmap.java Multicast.java OS.java
PasswordCallback.java Poll.java Pool.java
PoolCallback.java Proc.java ProcErrorCallback.java
Procattr.java SSL.java SSLContext.java
SSLSocket.java Shm.java Sockaddr.java Socket.java
Status.java Stdlib.java Time.java User.java
   jni/native/include ssl_private.h tcn.h tcn_version.h
   jni/native/os/netware system.c
   jni/native/os/unix system.c uxpipe.c
   jni/native/os/win32 ntpipe.c system.c
   jni/native/src dir.c error.c file.c info.c jnilib.c lock.c
misc.c mmap.c network.c os.c poll.c pool.c proc.c
shm.c ssl.c sslcontext.c sslinfo.c sslnetwork.c
sslutils.c stdlib.c user.c
  Log:
  Update Copyright comments to reflect the current year.
  
  Revision  ChangesPath
  1.15  +2 -2  
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java
  
  Index: Echo.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Echo.java 18 Jun 2005 08:03:21 -  1.14
  +++ Echo.java 12 Jul 2005 14:56:09 -  1.15
  @@ -1,5 +1,5 @@
   /*
  - *  Copyright 1999-2004 The Apache Software Foundation
  + *  Copyright 2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  
  
  
  1.2   +1 -1  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/Apr.java
  
  Index: Apr.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/Apr.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Apr.java  14 Jan 2005 13:45:58 -  1.1
  +++ Apr.java  12 Jul 2005 14:56:09 -  1.2
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 1999,2004 The Apache Software Foundation.
  + * Copyright 2000-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
  
  
  
  1.8   +2 -2  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Address.java
  
  Index: Address.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Address.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Address.java  1 Jun 2005 12:50:51 -   1.7
  +++ Address.java  12 Jul 2005 14:56:09 -  1.8
  @@ -1,5 +1,5 @@
   /*
  - *  Copyright 1999-2004 The Apache Software Foundation
  + *  Copyright 2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  
  
  
  1.5   +2 -2  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/BIOCallback.java
  
  Index: BIOCallback.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/BIOCallback.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BIOCallback.java  9 Jun 2005 09:33:40 -   1.4
  +++ BIOCallback.java  12 Jul 2005 14:56:09 -  1.5
  @@ -1,5 +1,5 @@
   /*
  - *  Copyright 1999-2004 The Apache Software Foundation
  + *  Copyright 2000-2005 The Apache Software Foundation
*
*  Licensed under the Apache License, Version 2.0 (the License);
*  you may not use this file except in compliance with the License.
  
  
  
  1.3   +2 -2  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Directory.java
  
  Index: Directory.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Directory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Directory.java14 Jan 2005 14:42:37 -  1.2
  +++ Directory.java12 Jul 2005 14:56:09 -  1.3
  @@ -1,5 +1,5 @@
   /*
  - *  Copyright 1999-2004 The Apache Software Foundation
  + *  Copyright 2000

cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-07-08 Thread mturk
mturk   2005/07/08 00:19:10

  Modified:jni/java/org/apache/tomcat/jni SSL.java
   jni/native/include ssl_private.h
   jni/native/src sslinfo.c
  Log:
  Add SSL_INFO_CLIENT_CERT_CHAIN param getter.
  Right now the majority of info's are returned in PEM format,
  meaning with :
  ---BEGIN XXX 
  
  ---END XXX ---
  We have to see how to return the actual data in byte array if desired.
  
  Revision  ChangesPath
  1.21  +5 -2  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSL.java
  
  Index: SSL.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSL.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- SSL.java  17 Jun 2005 09:41:30 -  1.20
  +++ SSL.java  8 Jul 2005 07:19:10 -   1.21
  @@ -203,7 +203,10 @@
   public static final int SSL_INFO_SERVER_A_SIG  = 0x0205;
   public static final int SSL_INFO_SERVER_A_KEY  = 0x0206;
   public static final int SSL_INFO_SERVER_CERT   = 0x0207;
  -
  +/* Return client certificate chain.
  + * Add certificate chain number to that flag (0 ... verify depth)
  + */
  +public static final int SSL_INFO_CLIENT_CERT_CHAIN = 0x0400;
   /* Return OpenSSL version number */
   public static native int version();
   
  
  
  
  1.33  +2 -1  
jakarta-tomcat-connectors/jni/native/include/ssl_private.h
  
  Index: ssl_private.h
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/native/include/ssl_private.h,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ssl_private.h 7 Jul 2005 08:10:08 -   1.32
  +++ ssl_private.h 8 Jul 2005 07:19:10 -   1.33
  @@ -188,6 +188,7 @@
   #define SSL_INFO_SERVER_A_SIG   (0x0205)
   #define SSL_INFO_SERVER_A_KEY   (0x0206)
   #define SSL_INFO_SERVER_CERT(0x0207)
  +#define SSL_INFO_CLIENT_CERT_CHAIN  (0x0400)
   
   #define SSL_VERIFY_ERROR_IS_OPTIONAL(errnum) \
  ((errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) \
  
  
  
  1.5   +15 -2 jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sslinfo.c 17 Jun 2005 09:41:30 -  1.4
  +++ sslinfo.c 8 Jul 2005 07:19:10 -   1.5
  @@ -105,7 +105,7 @@
   n = BIO_pending(bio);
   result = malloc(n+1);
   n = BIO_read(bio, result, n);
  -result[n] = '\n';
  +result[n] = '\0';
   BIO_free(bio);
   return result;
   }
  @@ -399,6 +399,19 @@
   }
   rv = APR_SUCCESS;
   }
  +else if (what  SSL_INFO_CLIENT_CERT_CHAIN) {
  +X509 *xs;
  +char *result;
  +STACK_OF(X509) *sk =  SSL_get_peer_cert_chain(s-ssl);
  +int n = what  0x0F;
  +if (n  sk_X509_num(sk)) {
  +xs = sk_X509_value(sk, n);
  +if ((result = get_cert_PEM(xs))) {
  +value = tcn_new_string(e, result);
  +free(result);
  +}
  +}
  +}
   if (rv != APR_SUCCESS)
   tcn_ThrowAPRException(e, rv);
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-07-08 Thread mturk
mturk   2005/07/08 00:49:56

  Modified:jni/native/src sslinfo.c
  Log:
  Add param infos in ASN1 format for server and client certificates.
  
  Revision  ChangesPath
  1.6   +78 -8 jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- sslinfo.c 8 Jul 2005 07:19:10 -   1.5
  +++ sslinfo.c 8 Jul 2005 07:49:56 -   1.6
  @@ -95,21 +95,40 @@
   
   static char *get_cert_PEM(X509 *xs)
   {
  -char *result;
  +char *result = NULL;
   BIO *bio;
  -int n;
   
   if ((bio = BIO_new(BIO_s_mem())) == NULL)
   return NULL;
  -PEM_write_bio_X509(bio, xs);
  -n = BIO_pending(bio);
  -result = malloc(n+1);
  -n = BIO_read(bio, result, n);
  -result[n] = '\0';
  +if (PEM_write_bio_X509(bio, xs)) {
  +int n = BIO_pending(bio);
  +result = malloc(n+1);
  +n = BIO_read(bio, result, n);
  +result[n] = '\0';
  +}
  +BIO_free(bio);
  +return result;
  +}
  +
  +static unsigned char *get_cert_ASN1(X509 *xs, int *len)
  +{
  +char *result = NULL;
  +BIO *bio;
  +
  +*len = 0;
  +if ((bio = BIO_new(BIO_s_mem())) == NULL)
  +return NULL;
  +if (i2d_X509_bio(bio, xs)) {
  +int n = BIO_pending(bio);
  +result = malloc(n);
  +n = BIO_read(bio, result, n);
  +*len = n;
  +}
   BIO_free(bio);
   return result;
   }
   
  +
   static char *get_cert_serial(X509 *xs)
   {
   char *result;
  @@ -186,6 +205,7 @@
   {
   tcn_ssl_conn_t *s = J2P(sock, tcn_ssl_conn_t *);
   jbyteArray array = NULL;
  +apr_status_t rv = APR_SUCCESS;
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  @@ -204,6 +224,56 @@
   tcn_ThrowAPRException(e, APR_EINVAL);
   break;
   }
  +if (what  SSL_INFO_CLIENT_MASK) {
  +X509 *xs;
  +unsigned char *result;
  +int len;
  +if ((xs = SSL_get_peer_certificate(s-ssl)) != NULL) {
  +switch (what) {
  +case SSL_INFO_CLIENT_CERT:
  +if ((result = get_cert_ASN1(xs, len))) {
  +array = tcn_new_arrayb(e, result, len);
  +free(result);
  +}
  +break;
  +}
  +X509_free(xs);
  +}
  +rv = APR_SUCCESS;
  +}
  +else if (what  SSL_INFO_SERVER_MASK) {
  +X509 *xs;
  +unsigned char *result;
  +int len;
  +if ((xs = SSL_get_certificate(s-ssl)) != NULL) {
  +switch (what) {
  +case SSL_INFO_SERVER_CERT:
  +if ((result = get_cert_ASN1(xs, len))) {
  +array = tcn_new_arrayb(e, result, len);
  +free(result);
  +}
  +break;
  +}
  +/* XXX: No need to call the X509_free(xs); */
  +}
  +rv = APR_SUCCESS;
  +}
  +else if (what  SSL_INFO_CLIENT_CERT_CHAIN) {
  +X509 *xs;
  +unsigned char *result;
  +STACK_OF(X509) *sk =  SSL_get_peer_cert_chain(s-ssl);
  +int len, n = what  0x0F;
  +if (n  sk_X509_num(sk)) {
  +xs = sk_X509_value(sk, n);
  +if ((result = get_cert_ASN1(xs, len))) {
  +array = tcn_new_arrayb(e, result, len);
  +free(result);
  +}
  +}
  +rv = APR_SUCCESS;
  +}
  +if (rv != APR_SUCCESS)
  +tcn_ThrowAPRException(e, rv);
   
   return array;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/include ssl_private.h

2005-07-07 Thread mturk
mturk   2005/07/07 01:10:08

  Modified:jni/native/include ssl_private.h
  Log:
  Add openssl/md5.h to the includes. This is needed with 0.9.8
  and it doean't hurt previous versions.
  
  Revision  ChangesPath
  1.32  +2 -1  
jakarta-tomcat-connectors/jni/native/include/ssl_private.h
  
  Index: ssl_private.h
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/native/include/ssl_private.h,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ssl_private.h 17 Jun 2005 09:41:30 -  1.31
  +++ ssl_private.h 7 Jul 2005 08:10:08 -   1.32
  @@ -47,6 +47,7 @@
   #include openssl/evp.h
   #include openssl/rand.h
   #include openssl/x509v3.h
  +#include openssl/md5.h
   /* Avoid tripping over an engine build installed globally and detected
* when the user points at an explicit non-engine flavor of OpenSSL
*/
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslutils.c

2005-07-07 Thread mturk
mturk   2005/07/07 01:12:30

  Modified:jni/native/src sslutils.c
  Log:
  Remove CA verify hack. The CA verification works, only that
  for CA file one needs to use the real CA or self generated one.
  
  Revision  ChangesPath
  1.31  +1 -5  jakarta-tomcat-connectors/jni/native/src/sslutils.c
  
  Index: sslutils.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslutils.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- sslutils.c18 Jun 2005 08:01:54 -  1.30
  +++ sslutils.c7 Jul 2005 08:12:30 -   1.31
  @@ -666,10 +666,6 @@
*/
   ok = 0;
   }
  -#if 1
  -else if (!ok)
  -ok = 1;
  -#endif
   return ok;
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslnetwork.c

2005-07-07 Thread mturk
mturk   2005/07/07 01:35:47

  Modified:jni/java/org/apache/tomcat/jni SSLSocket.java
   jni/native/src sslnetwork.c
  Log:
  Add SSL renegotiate support to be able to attach a different context
  after the header has been read and before any resonse has been send.
  
  We'll see if Tomcat can use something like that. At least it has to
  explicitly configured, like in mod_ssl by using:
  SSLOptions +OptRenegotiate.
  
  Revision  ChangesPath
  1.16  +17 -1 
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java
  
  Index: SSLSocket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SSLSocket.java18 Jun 2005 08:03:21 -  1.15
  +++ SSLSocket.java7 Jul 2005 08:35:46 -   1.16
  @@ -43,6 +43,22 @@
   public static native int handshake(long thesocket);
   
   /**
  + * Do a SSL renegotiation.
  + * SSL supports per-directory re-configuration of SSL parameters.
  + * This is implemented by performing an SSL renegotiation of the
  + * re-configured parameters after the request is read, but before the
  + * response is sent. In more detail: the renegotiation happens after the
  + * request line and MIME headers were read, but _before_ the attached
  + * request body is read. The reason simply is that in the HTTP protocol
  + * usually there is no acknowledgment step between the headers and the
  + * body (there is the 100-continue feature and the chunking facility
  + * only), so Apache has no API hook for this step.
  + *
  + * @param thesocket The socket to use
  + */
  +public static native int renegotiate(long thesocket);
  +
  +/**
* Retrun SSL Info parameter as byte array.
*
* @param sock The socket to read the data from.
  
  
  
  1.22  +13 -1 jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
  
  Index: sslnetwork.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- sslnetwork.c  2 Jul 2005 07:19:10 -   1.21
  +++ sslnetwork.c  7 Jul 2005 08:35:46 -   1.22
  @@ -495,6 +495,18 @@
   return APR_SUCCESS;
   }
   
  +TCN_IMPLEMENT_CALL(jint, SSLSocket, renegotiate)(TCN_STDARGS,
  + jlong sock)
  +{
  +tcn_socket_t *s   = J2P(sock, tcn_socket_t *);
  +tcn_ssl_conn_t *con;
  +
  +UNREFERENCED_STDARGS;
  +TCN_ASSERT(sock != 0);
  +con = (tcn_ssl_conn_t *)s-opaque;
  +return SSL_renegotiate(con-ssl);
  +}
  +
   #else
   /* OpenSSL is not supported
* If someday we make OpenSSL optional
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/examples mkcerts

2005-07-07 Thread mturk
mturk   2005/07/07 02:14:14

  Modified:jni/examples mkcerts
  Log:
  Update mkcerts to create a cabundle.crt file in the form of the original
  ca-bundle.crt file, that will have only our ca.crt.
  This can be used a CAfile for our demo Root CA.
  
  Revision  ChangesPath
  1.2   +13 -0 jakarta-tomcat-connectors/jni/examples/mkcerts
  
  Index: mkcerts
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/examples/mkcerts,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mkcerts   5 Jul 2005 16:14:16 -   1.1
  +++ mkcerts   7 Jul 2005 09:14:14 -   1.2
  @@ -25,7 +25,10 @@
   if [ -z $OPENSSL ]; then OPENSSL=openssl; fi
   
   PASSPHRASE=pass:secret
  +# Encrypt all keys
   GENRSA=$OPENSSL genrsa -des3
  +# Uncomment for no key encryption
  +# GENRSA=$OPENSSL genrsa
   REQ=$OPENSSL req -new
   CA=$OPENSSL ca
   X509=$OPENSSL x509
  @@ -112,6 +115,16 @@
   
   $REQ -x509 -days 3650 -batch -config ca.cfg -key ca.key -out ca.crt
   
  +# Create cabundle.crt that can be used for CAfile
  +cat cabundle.crt EOT
  +Tomcat Demo Root CA
  +=
  +`$X509 -noout -fingerprint -in ca.crt`
  +PEM Data:
  +`$X509 -in ca.crt`
  +`$X509 -noout -text -in ca.crt`
  +EOT
  +
   $GENRSA -passout $PASSPHRASE -out localhost.key  -rand .rnd 1024
   
   cat localhost.cfg EOT
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni Socket.java

2005-07-07 Thread mturk
mturk   2005/07/07 05:45:09

  Modified:jni/java/org/apache/tomcat/jni Socket.java
  Log:
  optGet throws exception if APR call returns != APR_SUCCESS
  
  Revision  ChangesPath
  1.19  +3 -2  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Socket.java
  
  Index: Socket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Socket.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Socket.java   18 Jun 2005 16:36:15 -  1.18
  +++ Socket.java   7 Jul 2005 12:45:08 -   1.19
  @@ -418,7 +418,8 @@
* /PRE
* @return Socket option returned on the call.
*/
  -public static native int optGet(long sock, int opt);
  +public static native int optGet(long sock, int opt)
  +throws Exception;
   
   /**
* Setup socket timeout for the specified socket
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslnetwork.c

2005-07-07 Thread mturk
mturk   2005/07/07 08:20:54

  Modified:jni/native/src sslnetwork.c
  Log:
  SSL clears the errno, so make sure the errno is remembered before
  the SSL_get_error call.
  
  Revision  ChangesPath
  1.23  +8 -8  jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
  
  Index: sslnetwork.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- sslnetwork.c  7 Jul 2005 08:35:46 -   1.22
  +++ sslnetwork.c  7 Jul 2005 15:20:54 -   1.23
  @@ -345,6 +345,7 @@
   
   for (;;) {
   if ((s = SSL_read(con-ssl, buf, rd)) = 0) {
  +apr_status_t os = apr_get_netos_error();
   int i = SSL_get_error(con-ssl, s);
   /* Special case if the close notify alert send by peer */
   if (s == 0  (con-ssl-shutdown  SSL_RECEIVED_SHUTDOWN)) {
  @@ -363,11 +364,10 @@
   }
   break;
   case SSL_ERROR_SYSCALL:
  -s = apr_get_netos_error();
  -if (!APR_STATUS_IS_EAGAIN(s) 
  -!APR_STATUS_IS_EINTR(s)) {
  +if (!APR_STATUS_IS_EAGAIN(os) 
  +!APR_STATUS_IS_EINTR(os)) {
   con-shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
  -return s;
  +return os;
   }
   break;
   default:
  @@ -393,6 +393,7 @@
   
   for (;;) {
   if ((s = SSL_write(con-ssl, buf, rd)) = 0) {
  +apr_status_t os = apr_get_netos_error();
   int i = SSL_get_error(con-ssl, s);
   switch (i) {
   case SSL_ERROR_ZERO_RETURN:
  @@ -406,9 +407,8 @@
   }
   break;
   case SSL_ERROR_SYSCALL:
  -s = apr_get_netos_error();
  -if (!APR_STATUS_IS_EAGAIN(s) 
  -!APR_STATUS_IS_EINTR(s)) {
  +if (!APR_STATUS_IS_EAGAIN(os) 
  +!APR_STATUS_IS_EINTR(os)) {
   con-shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
   return s;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslnetwork.c

2005-07-07 Thread mturk
mturk   2005/07/07 08:28:58

  Modified:jni/native/src sslnetwork.c
  Log:
  Return the original errno on send too.
  
  Revision  ChangesPath
  1.24  +4 -4  jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
  
  Index: sslnetwork.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- sslnetwork.c  7 Jul 2005 15:20:54 -   1.23
  +++ sslnetwork.c  7 Jul 2005 15:28:58 -   1.24
  @@ -340,11 +340,11 @@
   ssl_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
   {
   tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
  -int s, rd = (int)(*len);
  +int s, wr = (int)(*len);
   apr_status_t rv = APR_SUCCESS;
   
   for (;;) {
  -if ((s = SSL_read(con-ssl, buf, rd)) = 0) {
  +if ((s = SSL_read(con-ssl, buf, wr)) = 0) {
   apr_status_t os = apr_get_netos_error();
   int i = SSL_get_error(con-ssl, s);
   /* Special case if the close notify alert send by peer */
  @@ -410,7 +410,7 @@
   if (!APR_STATUS_IS_EAGAIN(os) 
   !APR_STATUS_IS_EINTR(os)) {
   con-shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
  -return s;
  +return os;
   }
   break;
   default:
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslnetwork.c

2005-07-07 Thread mturk
mturk   2005/07/07 09:02:02

  Modified:jni/native/src sslnetwork.c
  Log:
  Use alread provided os error for unknown errors.
  
  Revision  ChangesPath
  1.25  +3 -3  jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
  
  Index: sslnetwork.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- sslnetwork.c  7 Jul 2005 15:28:58 -   1.24
  +++ sslnetwork.c  7 Jul 2005 16:02:01 -   1.25
  @@ -371,7 +371,7 @@
   }
   break;
   default:
  -return apr_get_netos_error();
  +return os;
   break;
   }
   }
  @@ -414,7 +414,7 @@
   }
   break;
   default:
  -return apr_get_netos_error();
  +return os;
   break;
   }
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/examples mkcerts

2005-07-05 Thread mturk
mturk   2005/07/05 09:14:16

  Added:   jni/examples mkcerts
  Log:
  Add a script for demo self signed certificates.
  This is for _DEMONSTRATION ONLY_ . Do not use it in real world
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-connectors/jni/examples/mkcerts
  
  Index: mkcerts
  ===
  #!/bin/sh
  #
  # Copyright 1999-2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the License);
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  # http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an AS IS BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  #
  # This is the configuration file to treate the CA certificate of the
  # _DEMONSTRATION ONLY_ 'Coyote' Certificate Authority.
  # This CA is used to sign the localhost.crt and user.crt
  # because self-signed server certificates are not accepted by all browsers.
  # NEVER USE THIS CA YOURSELF FOR REAL LIFE! INSTEAD EITHER USE A PUBLICALLY
  # KNOWN CA OR CREATE YOUR OWN CA!
  
  if [ -z $OPENSSL ]; then OPENSSL=openssl; fi
  
  PASSPHRASE=pass:secret
  GENRSA=$OPENSSL genrsa -des3
  REQ=$OPENSSL req -new
  CA=$OPENSSL ca
  X509=$OPENSSL x509
  
  $OPENSSL rand -out .rnd 8192
  $GENRSA -passout $PASSPHRASE -out ca.key -rand .rnd 1024
  
  cat ca.cfg EOT
  [ ca ]
  default_ca  = default_db
  [ default_db ]
  dir = .
  certs   = .
  new_certs_dir   = ca.certs
  database= ca.index
  serial  = ca.serial
  RANDFILE= .rnd
  certificate = ca.crt
  private_key = ca.key
  default_days= 365
  default_crl_days= 30
  default_md  = md5
  preserve= no
  name_opt= ca_default
  cert_opt= ca_default
  unique_subject  = no
  [ server_policy ]
  countryName = supplied
  stateOrProvinceName = supplied
  localityName= supplied
  organizationName= supplied
  organizationalUnitName  = supplied
  commonName  = supplied
  emailAddress= supplied
  [ server_cert ]
  subjectKeyIdentifier= hash
  authorityKeyIdentifier  = keyid:always
  extendedKeyUsage= serverAuth,clientAuth,msSGC,nsSGC
  basicConstraints= critical,CA:false
  [ user_policy ]
  commonName  = supplied
  emailAddress= supplied
  [ user_cert ]
  subjectAltName  = email:copy
  basicConstraints= critical,CA:false
  authorityKeyIdentifier  = keyid:always
  extendedKeyUsage= clientAuth,emailProtection
  
  [ req ]
  default_bits= 1024
  default_keyfile = ca.key
  distinguished_name  = default_ca
  x509_extensions = extensions
  string_mask = nombstr
  req_extensions  = req_extensions
  input_password  = secret
  output_password = secret
  [ default_ca ]
  countryName = Country Code
  countryName_value   = US
  countryName_min = 2
  countryName_max = 2
  stateOrProvinceName = State Name
  stateOrProvinceName_value   = Delaware
  localityName= Locality Name
  localityName_value  = Wilmington
  organizationName= Organization Name
  organizationName_value  = Apache Software Foundation
  organizationalUnitName  = Organizational Unit Name
  organizationalUnitName_value= Apache Tomcat
  commonName  = Common Name
  commonName_value= Tomcat Demo Root CA
  commonName_max  = 64
  emailAddress= Email Address
  emailAddress_value  = [EMAIL PROTECTED]
  emailAddress_max= 40
  [ extensions ]
  subjectKeyIdentifier= hash
  authorityKeyIdentifier  = keyid:always
  basicConstraints= critical,CA:true
  [ req_extensions ]
  nsCertType  = objsign,email,server
  EOT
  
  $REQ -x509 -days 3650 -batch -config ca.cfg -key ca.key -out ca.crt
  
  $GENRSA -passout $PASSPHRASE -out localhost.key  -rand .rnd 1024
  
  cat localhost.cfg EOT
  [ req ]
  default_bits

cvs commit: jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni SSL.properties

2005-07-05 Thread mturk
mturk   2005/07/05 09:24:06

  Modified:jni/examples/org/apache/tomcat/jni SSL.properties
  Log:
  Update properties to use the certificates generated with mkcerts script.
  
  Revision  ChangesPath
  1.3   +4 -3  
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/SSL.properties
  
  Index: SSL.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/SSL.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SSL.properties7 Jun 2005 09:16:59 -   1.2
  +++ SSL.properties5 Jul 2005 16:24:06 -   1.3
  @@ -1,6 +1,7 @@
   # SSL Server and client properties
   server.port=4443
  -server.cert=server.crt
  -server.key=server.key
  +server.cert=localhost.crt
  +server.key=localhost.key
  +server.password=secret
   
server.ciphers=ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
  -#server.password=Certificate password goes here.
  +server.verify=none
  \ No newline at end of file
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src network.c sslnetwork.c

2005-07-02 Thread mturk
mturk   2005/07/02 00:19:11

  Modified:jni/native/include tcn.h
   jni/native/os/unix uxpipe.c
   jni/native/os/win32 ntpipe.c
   jni/native/src network.c sslnetwork.c
  Log:
  Used abstract structure for setting the network layer instead directly
  setting the functions. There is no function change, just the code is
  easier to read and maintain.
  
  Revision  ChangesPath
  1.29  +14 -11jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- tcn.h 30 Jun 2005 08:20:56 -  1.28
  +++ tcn.h 2 Jul 2005 07:19:10 -   1.29
  @@ -120,21 +120,24 @@
   #define TCN_SOCKET_GET_TYPE 3
   
   typedef struct {
  -apr_pool_t   *pool;
  -apr_socket_t *sock;
  -void *opaque;
  -int  type;
  +int type;
   apr_status_t (*cleanup)(void *);
  -apr_status_t (APR_THREAD_FUNC *tmset)(apr_socket_t *, 
apr_interval_time_t);
  -apr_status_t (APR_THREAD_FUNC *tmget)(apr_socket_t *, 
apr_interval_time_t *);
  -apr_status_t (APR_THREAD_FUNC *set)(apr_socket_t *, apr_int32_t, 
apr_int32_t);
  -apr_status_t (APR_THREAD_FUNC *get)(apr_socket_t *, apr_int32_t, 
apr_int32_t *);
  +apr_status_t (APR_THREAD_FUNC *close) (apr_socket_t *);
  +apr_status_t (APR_THREAD_FUNC *shutdown) (apr_socket_t *, 
apr_shutdown_how_e);
  +apr_status_t (APR_THREAD_FUNC *opt_get)(apr_socket_t *, apr_int32_t, 
apr_int32_t *);
  +apr_status_t (APR_THREAD_FUNC *opt_set)(apr_socket_t *, apr_int32_t, 
apr_int32_t);
  +apr_status_t (APR_THREAD_FUNC *timeout_get)(apr_socket_t *, 
apr_interval_time_t *);
  +apr_status_t (APR_THREAD_FUNC *timeout_set)(apr_socket_t *, 
apr_interval_time_t);
   apr_status_t (APR_THREAD_FUNC *send) (apr_socket_t *, const char *, 
apr_size_t *);
   apr_status_t (APR_THREAD_FUNC *sendv)(apr_socket_t *, const struct iovec 
*, apr_int32_t, apr_size_t *);
   apr_status_t (APR_THREAD_FUNC *recv) (apr_socket_t *, char *, apr_size_t 
*);
  -apr_status_t (APR_THREAD_FUNC *close) (apr_socket_t *);
  -apr_status_t (APR_THREAD_FUNC *shutdown) (apr_socket_t *, 
apr_shutdown_how_e);
  +} tcn_nlayer_t;
   
  +typedef struct {
  +apr_pool_t   *pool;
  +apr_socket_t *sock;
  +void *opaque;
  +tcn_nlayer_t *net;
   } tcn_socket_t;
   
   /* Private helper functions */
  
  
  
  1.3   +21 -25jakarta-tomcat-connectors/jni/native/os/unix/uxpipe.c
  
  Index: uxpipe.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/unix/uxpipe.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- uxpipe.c  30 Jun 2005 15:22:32 -  1.2
  +++ uxpipe.c  2 Jul 2005 07:19:10 -   1.3
  @@ -180,6 +180,20 @@
   return APR_SUCCESS;
   }
   
  +static tcn_nlayer_t uxp_socket_layer = {
  +TCN_SOCKET_UNIX,
  +uxp_cleanup,
  +uxp_socket_close,
  +uxp_socket_shutdown,
  +uxp_socket_opt_get,
  +uxp_socket_opt_set,
  +uxp_socket_timeout_get,
  +uxp_socket_timeout_set,
  +uxp_socket_send,
  +uxp_socket_sendv,
  +uxp_socket_recv
  +};
  +
   TCN_IMPLEMENT_CALL(jlong, Local, create)(TCN_STDARGS, jstring name,
jlong pool)
   {
  @@ -212,17 +226,9 @@
   else
   strcpy(con-uxaddr.sun_path, DEFNAME);
   s = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
  -s-pool = p;
  -s-type = TCN_SOCKET_UNIX;
  -s-cleanup  = uxp_cleanup;
  -s-recv = uxp_socket_recv;
  -s-send = uxp_socket_send;
  -s-sendv= uxp_socket_sendv;
  -s-shutdown = uxp_socket_shutdown;
  -s-tmget= uxp_socket_timeout_get;
  -s-tmset= uxp_socket_timeout_set;
  -s-close= uxp_socket_close;
  -s-opaque   = con;
  +s-pool   = p;
  +s-net= uxp_socket_layer;
  +s-opaque = con;
   apr_pool_cleanup_register(p, (const void *)s,
 uxp_socket_cleanup,
 apr_pool_cleanup_null);
  @@ -305,19 +311,9 @@
   apr_atomic_inc32(uxp_accepted);
   #endif
   a = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
  -a-pool = p;
  -a-type = TCN_SOCKET_UNIX;
  -a-cleanup  = uxp_cleanup;
  -a-recv = uxp_socket_recv;
  -a-send = uxp_socket_send;
  -a-sendv= uxp_socket_sendv;
  -a-shutdown = uxp_socket_shutdown;
  -a-tmget= uxp_socket_timeout_get;
  -a-tmset= uxp_socket_timeout_set;
  -a-get  = uxp_socket_opt_get;
  -a-set  = uxp_socket_opt_set;
  -a-close= uxp_socket_close

cvs commit: jakarta-tomcat-connectors/jni/native/os/unix uxpipe.c

2005-07-02 Thread mturk
mturk   2005/07/02 01:24:21

  Modified:jni/native/os/unix uxpipe.c
  Log:
  type is now member of net structure.
  
  Revision  ChangesPath
  1.4   +8 -10 jakarta-tomcat-connectors/jni/native/os/unix/uxpipe.c
  
  Index: uxpipe.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/unix/uxpipe.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- uxpipe.c  2 Jul 2005 07:19:10 -   1.3
  +++ uxpipe.c  2 Jul 2005 08:24:21 -   1.4
  @@ -170,9 +170,9 @@
   {
   tcn_socket_t *s = (tcn_socket_t *)data;
   
  -if (s-cleanup) {
  -(*s-cleanup)(s-opaque);
  -s-cleanup = NULL;
  +if (s-net-cleanup) {
  +(*s-net-cleanup)(s-opaque);
  +s-net-cleanup = NULL;
   }
   #ifdef TCN_DO_STATISTICS
   apr_atomic_inc32(uxp_cleared);
  @@ -246,7 +246,7 @@
   UNREFERENCED_STDARGS;
   UNREFERENCED(sa);
   TCN_ASSERT(sock != 0);
  -if (s-type == TCN_SOCKET_UNIX) {
  +if (s-net-type == TCN_SOCKET_UNIX) {
   int rc;
   tcn_uxp_conn_t *c = (tcn_uxp_conn_t *)s-opaque;
   c-mode = TCN_UXP_SERVER;
  @@ -267,7 +267,7 @@
   UNREFERENCED_STDARGS;
   
   TCN_ASSERT(sock != 0);
  -if (s-type == TCN_SOCKET_UNIX) {
  +if (s-net-type == TCN_SOCKET_UNIX) {
   tcn_uxp_conn_t *c = (tcn_uxp_conn_t *)s-opaque;
   c-mode = TCN_UXP_SERVER;
   return apr_socket_listen(c-sock, (apr_int32_t)backlog);
  @@ -287,7 +287,7 @@
   TCN_ASSERT(sock != 0);
   
   TCN_THROW_IF_ERR(apr_pool_create(p, s-pool), p);
  -if (s-type == TCN_SOCKET_UNIX) {
  +if (s-net-type == TCN_SOCKET_UNIX) {
   apr_socklen_t len;
   tcn_uxp_conn_t *c = (tcn_uxp_conn_t *)s-opaque;
   con = (tcn_uxp_conn_t *)apr_pcalloc(p, sizeof(tcn_uxp_conn_t));
  @@ -330,15 +330,13 @@
jlong sa)
   {
   tcn_socket_t *s = J2P(sock, tcn_socket_t *);
  -apr_pool_t   *p = NULL;
  -tcn_socket_t *a = NULL;
   tcn_uxp_conn_t *con = NULL;
   int rc;
   
   UNREFERENCED(o);
   UNREFERENCED(sa);
   TCN_ASSERT(sock != 0);
  -if (s-type != TCN_SOCKET_UNIX)
  +if (s-net-type != TCN_SOCKET_UNIX)
   return APR_ENOTSOCK;
   con = (tcn_uxp_conn_t *)s-opaque;
   if (con-mode != TCN_UXP_UNKNOWN)
  
  
  

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



cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net AprEndpoint.java

2005-07-02 Thread mturk
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  ChangesPath
  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 -  1.52
  +++ AprEndpoint.java  2 Jul 2005 10:55:34 -   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]



cvs commit: jakarta-tomcat-connectors/jni/native/src network.c

2005-07-02 Thread mturk
mturk   2005/07/02 04:03:24

  Modified:jni/native/src network.c
  Log:
  Do not set net- members to NULL.
  
  Revision  ChangesPath
  1.43  +5 -5  jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- network.c 2 Jul 2005 07:19:10 -   1.42
  +++ network.c 2 Jul 2005 11:03:24 -   1.43
  @@ -179,10 +179,8 @@
   {
   tcn_socket_t *s = (tcn_socket_t *)data;
   
  -if (s-net-cleanup) {
  +if (s-net  s-net-cleanup)
   (*s-net-cleanup)(s-opaque);
  -s-net-cleanup = NULL;
  -}
   if (s-sock) {
   apr_socket_close(s-sock);
   s-sock = NULL;
  @@ -367,8 +365,10 @@
   #ifdef TCN_DO_STATISTICS
   apr_atomic_inc32(sp_closed);
   #endif
  -if (s-net-close)
  +if (s-net  s-net-close) {
   rv = (*s-net-close)(s-opaque);
  +s-net = NULL;
  +}
   if (s-sock) {
   rv = (jint)apr_socket_close(s-sock);
   s-sock = NULL;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net AprEndpoint.java

2005-07-02 Thread mturk
mturk   2005/07/02 10:18:46

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
   util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Fix the Sendfile implementation.
  The APR sendfile always make it's internal full loop if the
  socket timeout is larger then 0. Setting soket timeout to
  zero also makes the socket nonblocking.
  I have added a keepAlive flag to the sendfile data because with
  sendfile the processing is done inside senfile poller.
  
  Revision  ChangesPath
  1.18  +6 -0  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Http11AprProcessor.java   23 Jun 2005 11:47:32 -  1.17
  +++ Http11AprProcessor.java   2 Jul 2005 17:18:46 -   1.18
  @@ -884,9 +884,15 @@
   // Do sendfile as needed: add socket to sendfile and end
   if (sendfileData != null) {
   sendfileData.socket = socket;
  + sendfileData.keepAlive = keepAlive;
   if (!endpoint.getSendfile().add(sendfileData)) {
   keepAlive = false;
  +openSocket = false;
   }
  +else {
  + openSocket = true;
  +}
  +break;
   }
   
   }
  
  
  
  1.54  +19 -10
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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- AprEndpoint.java  2 Jul 2005 10:55:34 -   1.53
  +++ AprEndpoint.java  2 Jul 2005 17:18:46 -   1.54
  @@ -1062,6 +1062,8 @@
   public long socket;
   // Position
   public long pos;
  +// KeepAlive flag
  +public boolean keepAlive;
   }
   
   
  @@ -1147,10 +1149,10 @@
0, data.fdpool);
   data.pos = data.start;
   // Set the socket to nonblocking mode
  -Socket.optSet(data.socket, Socket.APR_SO_NONBLOCK, 1);
  +Socket.timeoutSet(data.socket, 0);
   while (true) {
   long nw = Socket.sendfile(data.socket, data.fd, null, 
null,
  - data.pos, data.end, 0);
  +  data.pos, data.end, 0);
   if (nw  0) {
   if (!(-nw == Status.EAGAIN)) {
/* The socket will be destroyed on the
  @@ -1167,7 +1169,7 @@
   // Entire file has been send
   Pool.destroy(data.fdpool);
   // Set back socket to blocking mode
  -Socket.optSet(data.socket, 
Socket.APR_SO_NONBLOCK, 0);
  +Socket.timeoutSet(data.socket, soTimeout * 1000);
   return true;
   }
   }
  @@ -1182,7 +1184,7 @@
   addS.add(data);
   addS.notify();
   }
  -return false;
  +return true;
   }
   
   /**
  @@ -1260,7 +1262,6 @@
   // Close socket and clear pool
   remove(state);
   // Destroy file descriptor pool, which 
should close the file
  -Pool.destroy(state.fdpool);
   // Close the socket, as the reponse would be 
incomplete
   Socket.destroy(state.socket);
   continue;
  @@ -1281,11 +1282,19 @@
   state.pos = state.pos + nw;
   if (state.pos = state.end) {
   remove(state);
  -// Destroy file descriptor pool, which 
should close the file
  -Pool.destroy(state.fdpool);
  -// If all done hand this socket off to a 
worker for
  -// processing of further requests
  -getWorkerThread().assign(desc[n*2+1]);
  +if (state.keepAlive

cvs commit: jakarta-tomcat-connectors/jni/native/src jnilib.c proc.c stdlib.c

2005-06-30 Thread mturk
mturk   2005/06/30 00:10:29

  Modified:jni/java/org/apache/tomcat/jni Stdlib.java
   jni/native/include tcn.h
   jni/native/src jnilib.c proc.c stdlib.c
  Log:
  Add getpid and getppid functions. The getppid function on WIndows is
  simulated by passing the environment value to the child process.
  
  Revision  ChangesPath
  1.3   +13 -1 
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Stdlib.java
  
  Index: Stdlib.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Stdlib.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Stdlib.java   14 Jan 2005 14:42:37 -  1.2
  +++ Stdlib.java   30 Jun 2005 07:10:29 -  1.3
  @@ -74,4 +74,16 @@
*/
   public static native void free(long mem);
   
  +/**
  + * Get current process pid.
  + * @return current pid or  1 in case of error.
  + */
  +public static native int getpid();
  +
  +/**
  + * Get current process parent pid.
  + * @return parent pid or  1 in case of error.
  + */
  +public static native int getppid();
  +
   }
  
  
  
  1.27  +2 -1  jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- tcn.h 23 Jun 2005 08:58:05 -  1.26
  +++ tcn.h 30 Jun 2005 07:10:29 -  1.27
  @@ -83,6 +83,7 @@
   #define TCN_FINFO_CLASS TCN_CLASS_PATH FileInfo
   #define TCN_AINFO_CLASS TCN_CLASS_PATH Sockaddr
   #define TCN_ERROR_CLASS TCN_CLASS_PATH Error
  +#define TCN_PARENT_IDE  TCN_PARENT_ID
   
   #define UNREFERENCED(P)  (P) = (P)
   #define UNREFERENCED_STDARGS e = e; o = o
  
  
  
  1.13  +12 -2 jakarta-tomcat-connectors/jni/native/src/jnilib.c
  
  Index: jnilib.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/jnilib.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- jnilib.c  23 Jun 2005 08:58:05 -  1.12
  +++ jnilib.c  30 Jun 2005 07:10:29 -  1.13
  @@ -42,6 +42,8 @@
   static jmethodID jString_init;
   static jmethodID jString_getBytes;
   
  +int tcn_parent_pid = 0;
  +
   /* Called by the JVM when APR_JAVA is loaded */
   JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
   {
  @@ -67,7 +69,15 @@
   return JNI_ERR;
   if(tcn_load_ainfo_class(env, jAinfo_class) != APR_SUCCESS)
   return JNI_ERR;
  -
  +#ifdef WIN32
  +{
  +char *ppid = getenv(TCN_PARENT_IDE);
  +if (ppid)
  +tcn_parent_pid = atoi(ppid);
  +}
  +#else
  +tcn_parent_pid = getppid();
  +#endif
   apr_initialize();
   
   return  JNI_VERSION_1_4;
  
  
  
  1.6   +19 -4 jakarta-tomcat-connectors/jni/native/src/proc.c
  
  Index: proc.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/proc.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- proc.c17 Jun 2005 09:41:30 -  1.5
  +++ proc.c30 Jun 2005 07:10:29 -  1.6
  @@ -209,7 +209,7 @@
   as = (*e)-GetArrayLength(e, args);
   if (env)
   es = (*e)-GetArrayLength(e, args);
  -if (as  MAX_ARGS_SIZE || es  MAX_ENV_SIZE) {
  +if (as  (MAX_ARGS_SIZE - 1) || es  (MAX_ENV_SIZE - 2)) {
   TCN_FREE_CSTRING(progname);
   return APR_EINVAL;
   }
  @@ -219,19 +219,34 @@
   s_args[i] = tcn_get_string(e, str);
   (*e)-DeleteLocalRef(e, str);
   }
  +s_args[i] = NULL;
   pargs = (const char * const *)s_args[0];
   }
   if (es) {
   for (i = 0; i  es; i++) {
   jstring str = (*e)-GetObjectArrayElement(e, env, i);
  -s_env[i] = tcn_get_string(e, str);
  +s_env[i+1] = tcn_get_string(e, str);
   (*e)-DeleteLocalRef(e, str);
   }
  +#ifdef WIN32
  +s_env[i++] = apr_psprintf(p, TCN_PARENT_IDE =%d, getpid());
  +#endif
  +s_env[i] = NULL;
   penv = (const char * const *)s_env[0];
   }
  -
  +#ifdef WIN32
  +else {
  +char pps[32];
  +itoa(getpid(), pps, 10);
  +SetEnvironmentVariable(TCN_PARENT_IDE, pps);
  +}
  +#endif
   rv = apr_proc_create(np, J2S(progname), pargs,
penv, a, p);
  +#ifdef WIN32
  +if (!es)
  +SetEnvironmentVariable(TCN_PARENT_IDE, NULL);
  +#endif
   
   /* Free local resources */
   TCN_FREE_CSTRING(progname);
  
  
  
  1.4   +15 -1 jakarta-tomcat-connectors/jni

cvs commit: jakarta-tomcat-connectors/jni/native/src network.c sslnetwork.c

2005-06-30 Thread mturk
mturk   2005/06/30 01:20:56

  Modified:jni/native/include tcn.h
   jni/native/os/win32 ntpipe.c
   jni/native/src network.c sslnetwork.c
  Log:
  Add abstracts for getting and setting the socket options.
  We need that becasue nt pipes or unix sockets can not
  use the apr functions directly, and we have some extra params.
  In general, this is still function trough pointer call.
  
  Revision  ChangesPath
  1.28  +3 -1  jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- tcn.h 30 Jun 2005 07:10:29 -  1.27
  +++ tcn.h 30 Jun 2005 08:20:56 -  1.28
  @@ -127,6 +127,8 @@
   apr_status_t (*cleanup)(void *);
   apr_status_t (APR_THREAD_FUNC *tmset)(apr_socket_t *, 
apr_interval_time_t);
   apr_status_t (APR_THREAD_FUNC *tmget)(apr_socket_t *, 
apr_interval_time_t *);
  +apr_status_t (APR_THREAD_FUNC *set)(apr_socket_t *, apr_int32_t, 
apr_int32_t);
  +apr_status_t (APR_THREAD_FUNC *get)(apr_socket_t *, apr_int32_t, 
apr_int32_t *);
   apr_status_t (APR_THREAD_FUNC *send) (apr_socket_t *, const char *, 
apr_size_t *);
   apr_status_t (APR_THREAD_FUNC *sendv)(apr_socket_t *, const struct iovec 
*, apr_int32_t, apr_size_t *);
   apr_status_t (APR_THREAD_FUNC *recv) (apr_socket_t *, char *, apr_size_t 
*);
  
  
  
  1.2   +49 -3 jakarta-tomcat-connectors/jni/native/os/win32/ntpipe.c
  
  Index: ntpipe.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/win32/ntpipe.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ntpipe.c  24 Jun 2005 08:21:29 -  1.1
  +++ ntpipe.c  30 Jun 2005 08:20:56 -  1.2
  @@ -69,6 +69,8 @@
   DWORD  timeout;
   intmode; /* Client or server mode */
   intnmax;
  +DWORD  sndbuf;
  +DWORD  rcvbuf;
   char   name[MAX_PATH+1];
   SECURITY_ATTRIBUTES sa;
   } tcn_ntp_conn_t;
  @@ -105,6 +107,44 @@
   return APR_SUCCESS;
   }
   
  +static APR_INLINE apr_status_t APR_THREAD_FUNC
  +ntp_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on)
  +{
  +tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
  +apr_status_t rv = APR_SUCCESS;
  +switch (opt) {
  +case APR_SO_SNDBUF:
  +con-sndbuf = (DWORD)on;
  +break;
  +case APR_SO_RCVBUF:
  +con-rcvbuf = (DWORD)on;
  +break;
  +default:
  +rv = APR_EINVAL;
  +break; 
  +}
  +return rv;
  +}
  +
  +static APR_INLINE apr_status_t APR_THREAD_FUNC
  +ntp_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on)
  +{
  +tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
  +apr_status_t rv = APR_SUCCESS;
  +switch (opt) {
  +case APR_SO_SNDBUF:
  +*on = con-sndbuf;
  +break;
  +case APR_SO_RCVBUF:
  +*on = con-rcvbuf;
  +break;
  +default:
  +rv = APR_EINVAL;
  +break; 
  +}
  +return rv;
  +}
  +
   static apr_status_t ntp_cleanup(void *data)
   {
   tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)data;
  @@ -264,6 +304,8 @@
   con-mode = TCN_NTP_UNKNOWN;
   con-nmax = PIPE_UNLIMITED_INSTANCES;
   con-timeout = DEFTIMEOUT;
  +con-sndbuf  = DEFSIZE;
  +con-rcvbuf  = DEFSIZE;
   if (J2S(name)) {
   strncpy(con-name, J2S(name), MAX_PATH);
   con-name[MAX_PATH] = '\0';
  @@ -288,6 +330,8 @@
   s-shutdown = ntp_socket_shutdown;
   s-tmget= ntp_socket_timeout_get;
   s-tmset= ntp_socket_timeout_set;
  +s-get  = ntp_socket_opt_get;
  +s-set  = ntp_socket_opt_set;
   s-close= ntp_socket_close;
   s-opaque   = con;
   apr_pool_cleanup_register(p, (const void *)s,
  @@ -358,8 +402,8 @@
 PIPE_ACCESS_DUPLEX | 
FILE_FLAG_OVERLAPPED,
 PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | 
PIPE_WAIT,
 con-nmax,
  -  DEFSIZE,
  -  DEFSIZE,
  +  con-sndbuf,
  +  con-rcvbuf,
 con-timeout,
 c-sa);
   if (con-h_pipe == INVALID_HANDLE_VALUE) {
  @@ -399,6 +443,8 @@
   a-shutdown = ntp_socket_shutdown;
   a-tmget= ntp_socket_timeout_get;
   a-tmset= ntp_socket_timeout_set;
  +a-get  = ntp_socket_opt_get;
  +a-set

cvs commit: jakarta-tomcat-connectors/jni/native/os/unix uxpipe.c

2005-06-30 Thread mturk
mturk   2005/06/30 08:19:15

  Added:   jni/native/os/unix uxpipe.c
  Log:
  Add AF_UNIX network interface implementation.
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-connectors/jni/native/os/unix/uxpipe.c
  
  Index: uxpipe.c
  ===
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the License);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an AS IS BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /** UNIX AF_LOCAL network wrapper
   *
   * @author Mladen Turk
   * @version $Revision: 1.1 $, $Date: 2005/06/30 15:19:15 $
   */
  
  
  #include tcn.h
  #include apr_thread_mutex.h
  #include apr_poll.h
  
  /* ### should be tossed in favor of APR */
  #include sys/stat.h
  #include sys/un.h /* for sockaddr_un */
  
  #ifdef TCN_DO_STATISTICS
  #include apr_atomic.h
  
  static volatile apr_uint32_t uxp_created  = 0;
  static volatile apr_uint32_t uxp_closed   = 0;
  static volatile apr_uint32_t uxp_cleared  = 0;
  static volatile apr_uint32_t uxp_accepted = 0;
  
  void uxp_network_dump_statistics()
  {
  fprintf(stderr, NT Network Statistics ..\n);
  fprintf(stderr, Sockets created : %d\n, uxp_created);
  fprintf(stderr, Sockets accepted: %d\n, uxp_accepted);
  fprintf(stderr, Sockets closed  : %d\n, uxp_closed);
  fprintf(stderr, Sockets cleared : %d\n, uxp_cleared);
  }
  
  #endif
  
  #define DEFNAME /var/run/tomcatnativesock
  #define DEFNAME_FMT /var/run/tomcatnativesock%08x%08x
  #define DEFSIZE 8192
  #define DEFTIMEOUT  6
  
  #define TCN_UXP_UNKNOWN 0
  #define TCN_UXP_CLIENT  1
  #define TCN_UXP_ACCEPTED2
  #define TCN_UXP_SERVER  3
  
  #define TCN_UNIX_MAXPATH1024
  typedef struct {
  apr_pool_t  *pool;
  apr_socket_t*sock;   /* APR socket */
  int sd;
  struct sockaddr_un  uxaddr;
  int timeout;
  int mode; /* Client or server mode */
  charname[TCN_UNIX_MAXPATH+1];
  } tcn_uxp_conn_t;
  
  static apr_status_t APR_THREAD_FUNC
  uxp_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
  {
  tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
  if (t  0)
  con-timeout = -1;
  else
  con-timeout = (int)(apr_time_as_msec(t));
  return APR_SUCCESS;
  }
  
  static apr_status_t APR_THREAD_FUNC
  uxp_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t)
  {
  tcn_uxp_conn_t *con = (tcn_uxp_conn_t*)sock;
  if (con-timeout  0)
  *t = -1;
  else
  *t = con-timeout * 1000;
  return APR_SUCCESS;
  }
  
  static APR_INLINE apr_status_t APR_THREAD_FUNC
  uxp_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on)
  {
  tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
  return apr_socket_opt_set(con-sock, opt, on);
  }
  
  static APR_INLINE apr_status_t APR_THREAD_FUNC
  uxp_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on)
  {
  tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
  return apr_socket_opt_get(con-sock, opt, on);
  }
  
  static apr_status_t uxp_cleanup(void *data)
  {
  tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)data;
  
  if (con) {
  if (con-sock) {
  apr_socket_close(con-sock);
  con-sock = NULL;
  }
  if (con-mode == TCN_UXP_SERVER) {
  unlink(con-name);
  con-mode = TCN_UXP_UNKNOWN;
  }
  }
  
  #ifdef TCN_DO_STATISTICS
  apr_atomic_inc32(uxp_cleared);
  #endif
  return APR_SUCCESS;
  }
  
  static apr_status_t APR_THREAD_FUNC
  uxp_socket_shutdown(apr_socket_t *sock, apr_shutdown_how_e how)
  {
  tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
  return apr_socket_shutdown(con-sock, how);
  }
  
  static apr_status_t APR_THREAD_FUNC
  uxp_socket_close(apr_socket_t *sock)
  {
  #ifdef TCN_DO_STATISTICS
  apr_atomic_inc32(uxp_closed);
  #endif
  return uxp_cleanup(sock);
  }
  
  static apr_status_t APR_THREAD_FUNC
  uxp_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
  {
  tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
  return apr_socket_recv(con-sock, buf, len);
  }
  
  
  static apr_status_t APR_THREAD_FUNC
  uxp_socket_send(apr_socket_t *sock, const char *buf,
  apr_size_t *len)
  {
  tcn_uxp_conn_t *con = (tcn_uxp_conn_t *)sock;
  return

cvs commit: jakarta-tomcat-connectors/jni/native/os/unix uxpipe.c

2005-06-30 Thread mturk
mturk   2005/06/30 08:22:33

  Modified:jni/native/os/unix uxpipe.c
  Log:
  Fix typo. This is not NTPIPE :)
  
  Revision  ChangesPath
  1.2   +3 -3  jakarta-tomcat-connectors/jni/native/os/unix/uxpipe.c
  
  Index: uxpipe.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/os/unix/uxpipe.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- uxpipe.c  30 Jun 2005 15:19:15 -  1.1
  +++ uxpipe.c  30 Jun 2005 15:22:32 -  1.2
  @@ -306,7 +306,7 @@
   #endif
   a = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
   a-pool = p;
  -a-type = TCN_SOCKET_NTPIPE;
  +a-type = TCN_SOCKET_UNIX;
   a-cleanup  = uxp_cleanup;
   a-recv = uxp_socket_recv;
   a-send = uxp_socket_send;
  @@ -347,7 +347,6 @@
   con = (tcn_uxp_conn_t *)s-opaque;
   if (con-mode != TCN_UXP_UNKNOWN)
   return APR_EINVAL;
  -con-mode = TCN_UXP_CLIENT;
   do {
   rc = connect(con-sd, (const struct sockaddr *)(con-uxaddr),
sizeof(con-uxaddr));
  @@ -355,6 +354,7 @@
   
   if (rc == -1  errno != EISCONN)
   return errno;
  +con-mode = TCN_UXP_CLIENT;
   
   return APR_SUCCESS;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src network.c sslnetwork.c

2005-06-24 Thread mturk
mturk   2005/06/24 01:21:29

  Modified:jni/native libtcnative.dsp tcnative.dsp
   jni/native/src network.c sslnetwork.c
  Added:   jni/native/os/win32 ntpipe.c
  Log:
  Added NT Pipe network layer.
  The same will be done for AF_UNIX/AF_LOCAL.
  
  Revision  ChangesPath
  1.13  +4 -0  jakarta-tomcat-connectors/jni/native/libtcnative.dsp
  
  Index: libtcnative.dsp
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/libtcnative.dsp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- libtcnative.dsp   14 Jun 2005 11:55:54 -  1.12
  +++ libtcnative.dsp   24 Jun 2005 08:21:29 -  1.13
  @@ -196,6 +196,10 @@
   # PROP Default_Filter 
   # Begin Source File
   
  +SOURCE=.\os\win32\ntpipe.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\os\win32\system.c
   # End Source File
   # End Group
  
  
  
  1.13  +4 -0  jakarta-tomcat-connectors/jni/native/tcnative.dsp
  
  Index: tcnative.dsp
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/tcnative.dsp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- tcnative.dsp  14 Jun 2005 11:55:54 -  1.12
  +++ tcnative.dsp  24 Jun 2005 08:21:29 -  1.13
  @@ -196,6 +196,10 @@
   # PROP Default_Filter 
   # Begin Source File
   
  +SOURCE=.\os\win32\ntpipe.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\os\win32\system.c
   # End Source File
   # End Group
  
  
  
  1.1  jakarta-tomcat-connectors/jni/native/os/win32/ntpipe.c
  
  Index: ntpipe.c
  ===
  /* Copyright 2000-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the License);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an AS IS BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /** NT Pipes network wrapper
   *
   * @author Mladen Turk
   * @version $Revision: 1.1 $, $Date: 2005/06/24 08:21:29 $
   */
  
  
  #define _WIN32_WINNT 0x0500
  #define STRICT
  #include windows.h
  #include winsock.h
  #include sddl.h
  
  #include tcn.h
  #include apr_thread_mutex.h
  #include apr_poll.h
  
  #ifdef TCN_DO_STATISTICS
  #include apr_atomic.h
  
  static volatile apr_uint32_t ntp_created  = 0;
  static volatile apr_uint32_t ntp_closed   = 0;
  static volatile apr_uint32_t ntp_cleared  = 0;
  static volatile apr_uint32_t ntp_accepted = 0;
  
  void ntp_network_dump_statistics()
  {
  fprintf(stderr, NT Network Statistics ..\n);
  fprintf(stderr, Sockets created : %d\n, ntp_created);
  fprintf(stderr, Sockets accepted: %d\n, ntp_accepted);
  fprintf(stderr, Sockets closed  : %d\n, ntp_closed);
  fprintf(stderr, Sockets cleared : %d\n, ntp_cleared);
  }
  
  #endif
  
  #define DEFNAME .\\PIPE\\TOMCATNATIVEPIPE
  #define DEFNAME_FMT .\\PIPE\\TOMCATNATIVEPIPE%08X%08X
  #define DEFSIZE 8192
  #define DEFTIMEOUT  6
  
  #define TCN_NTP_UNKNOWN 0
  #define TCN_NTP_CLIENT  1
  #define TCN_NTP_SERVER  2
  
  typedef struct {
  apr_pool_t *pool;
  apr_socket_t   *sock;   /* Dummy socket */
  OVERLAPPED rd_o;
  OVERLAPPED wr_o;
  HANDLE h_pipe;
  HANDLE rd_event;
  HANDLE wr_event;
  DWORD  timeout;
  intmode; /* Client or server mode */
  intnmax;
  char   name[MAX_PATH+1];
  SECURITY_ATTRIBUTES sa;
  } tcn_ntp_conn_t;
  
  static const char *NTSD_STRING = D: /* Discretionary ACL */
 (D;OICI;GA;;;BG) /* Deny access to Built-in Guests */
 (D;OICI;GA;;;AN) /* Deny access to Anonymous Logon */
 (A;OICI;GRGWGX;;;AU) /* Allow read/write/execute to 
Authenticated Users */
 (A;OICI;GA;;;BA) /* Allow full control to 
Administrators */
 (A;OICI;GA;;;LS) /* Allow full control to Local 
service account */
 (A;OICI;GA;;;SY);/* Allow full control to Local 
system */
  
  
  
  static apr_status_t APR_THREAD_FUNC
  ntp_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t)
  {
  tcn_ntp_conn_t *con = (tcn_ntp_conn_t *)sock;
  if (t  0)
  con-timeout = INFINITE;
  else
  con-timeout = (DWORD

cvs commit: jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni Local.java

2005-06-24 Thread mturk
mturk   2005/06/24 01:22:58

  Modified:jni  build.xml
  Added:   jni/examples/org/apache/tomcat/jni Local.properties
LocalServer.java
   jni/java/org/apache/tomcat/jni Local.java
  Log:
  Added Local network implementation and example.
  
  Revision  ChangesPath
  1.9   +4 -4  jakarta-tomcat-connectors/jni/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/build.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- build.xml 10 Jun 2005 17:15:55 -  1.8
  +++ build.xml 24 Jun 2005 08:22:58 -  1.9
  @@ -309,13 +309,13 @@
   jvmarg value=-Djava.library.path=${tc.library.path}/
   /java
   /target
  -target name=bioserver-example depends=examples
  -echo message=Running another Tomcat Native SSL Server example 
.../
  -java dir=${examples.dir} 
classname=org.apache.tomcat.jni.BIOSSLServer
  +target name=locals-example depends=examples
  +echo message=Running Tomcat Native Local Server example .../
  +java dir=${examples.dir} 
classname=org.apache.tomcat.jni.LocalServer
fork=yes failonerror=${test.failonerror}
  +classpath refid=examples.classpath/
   env key=PATH path=${tc.library.path}:${java.library.path}/
   env key=Path path=${tc.library.path}:${java.library.path}/
  -classpath refid=examples.classpath/
   jvmarg value=-Djava.library.path=${tc.library.path}/
   /java
   /target
  
  
  
  1.1  
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Local.properties
  
  Index: Local.properties
  ===
  # Local properties
  local.max=10
  
  # For NT Pipes use something like
  local.path=.\\PIPE\\test
  
  # For Unix Sockets use
  # local.path=/tmp/testsock
  
  
  
  1.1  
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/LocalServer.java
  
  Index: LocalServer.java
  ===
  package org.apache.tomcat.jni;
  
  import java.util.Properties;
  
  import java.io.*;
  import java.net.*;
  import java.lang.*;
  
  /** Local Socket server example
   *
   * @author Mladen Turk
   * @version $Revision: 1.1 $, $Date: 2005/06/24 08:22:58 $
   */
  
  public class LocalServer {
  
  public static String serverAddr = null;
  public static int serverNmax= 0;
  public static int serverNrun= 0;
  public static long serverPool   = 0;
  
  private static Acceptor serverAcceptor = null;
  
  private static Object threadLock = new Object();
  
  static {
  
  try {
  InputStream is = LocalServer.class.getResourceAsStream
  (/org/apache/tomcat/jni/Local.properties);
  Properties props = new Properties();
  props.load(is);
  is.close();
  serverAddr = props.getProperty(local.path, null);
  serverNmax = Integer.decode(props.getProperty(local.max, 
0)).intValue();
  }
  catch (Throwable t) {
  ; // Nothing
  }
  }
  
  public LocalServer()
  {
  int i;
  serverPool = Pool.create(0);
  try {
  serverAcceptor = new Acceptor();
  serverAcceptor.start();
  
  } catch (Exception e) {
  e.printStackTrace();
  }
  
  }
  public static void incThreads() {
  synchronized(threadLock) {
  serverNrun++;
  }
  }
  
  public static void decThreads() {
  synchronized(threadLock) {
  serverNrun--;
  }
  }
  
  /* Acceptor thread. Listens for new connections */
  private class Acceptor extends Thread {
  private long serverSock = 0;
  private long inetAddress = 0;
  private long pool = 0;
  public Acceptor() throws Exception {
  try {
  
  pool = Pool.create(LocalServer.serverPool);
  System.out.println(Accepting:  +  LocalServer.serverAddr);
  serverSock = Local.create(LocalServer.serverAddr, pool);
  int rc = Local.bind(serverSock, inetAddress);
  if (rc != 0) {
throw(new Exception(Can't create Acceptor: bind:  + 
Error.strerror(rc)));
  }
  Local.listen(serverSock, LocalServer.serverNmax);
  }
  catch( Exception ex ) {
  ex.printStackTrace();
  throw(new Exception(Can't create Acceptor));
  }
  }
  
  public void run() {
  int i = 0;
  try {
  while (true

cvs commit: jakarta-tomcat-connectors/jni/native/src info.c jnilib.c network.c sslnetwork.c

2005-06-23 Thread mturk
mturk   2005/06/23 01:58:05

  Modified:jni/native/include tcn.h
   jni/native/src info.c jnilib.c network.c sslnetwork.c
  Log:
  Add function wrappers for getting and setting the timeout.
  Also catch the info classes to spped up it's prosessing.
  
  Revision  ChangesPath
  1.26  +5 -3  jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- tcn.h 18 Jun 2005 16:36:15 -  1.25
  +++ tcn.h 23 Jun 2005 08:58:05 -  1.26
  @@ -124,6 +124,8 @@
   void *opaque;
   int  type;
   apr_status_t (*cleanup)(void *);
  +apr_status_t (APR_THREAD_FUNC *tmset)(apr_socket_t *, 
apr_interval_time_t);
  +apr_status_t (APR_THREAD_FUNC *tmget)(apr_socket_t *, 
apr_interval_time_t *);
   apr_status_t (APR_THREAD_FUNC *send) (apr_socket_t *, const char *, 
apr_size_t *);
   apr_status_t (APR_THREAD_FUNC *sendv)(apr_socket_t *, const struct iovec 
*, apr_int32_t, apr_size_t *);
   apr_status_t (APR_THREAD_FUNC *recv) (apr_socket_t *, char *, apr_size_t 
*);
  @@ -142,8 +144,8 @@
   char   *tcn_get_string(JNIEnv *, jstring);
   char   *tcn_strdup(JNIEnv *, jstring);
   char   *tcn_pstrdup(JNIEnv *, jstring, apr_pool_t *);
  -apr_status_ttcn_load_finfo_class(JNIEnv *);
  -apr_status_ttcn_load_ainfo_class(JNIEnv *);
  +apr_status_ttcn_load_finfo_class(JNIEnv *, jclass);
  +apr_status_ttcn_load_ainfo_class(JNIEnv *, jclass);
   
   #define J2S(V)  c##V
   #define J2L(V)  p##V
  
  
  
  1.9   +65 -38jakarta-tomcat-connectors/jni/native/src/info.c
  
  Index: info.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/info.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- info.c17 Jun 2005 09:41:30 -  1.8
  +++ info.c23 Jun 2005 08:58:05 -  1.9
  @@ -121,17 +121,13 @@
   
   static int finfo_class_initialized = 0;
   static int ainfo_class_initialized = 0;
  +static jmethodID finfo_class_init = NULL;
  +static jmethodID ainfo_class_init = NULL;
  +static jclass finfo_class = NULL;
  +static jclass ainfo_class = NULL;
   
  -apr_status_t tcn_load_finfo_class(JNIEnv *e)
  +apr_status_t tcn_load_finfo_class(JNIEnv *e, jclass finfo)
   {
  -jclass finfo;
  -
  -finfo = (*e)-FindClass(e, TCN_FINFO_CLASS);
  -if (finfo == NULL) {
  -(*e)-ExceptionClear(e);
  -return APR_EGENERAL;
  -}
  -
   GET_FINFO_J(pool);
   GET_FINFO_I(valid);
   GET_FINFO_I(protection);
  @@ -149,33 +145,33 @@
   GET_FINFO_S(fname);
   GET_FINFO_S(name);
   GET_FINFO_J(filehand);
  -
  +
  +finfo_class_init = (*e)-GetMethodID(e, finfo,
  +  init, ()V);
  +if (finfo_class_init == NULL)
  +goto cleanup;
   finfo_class_initialized = 1;
  +finfo_class = finfo;
   cleanup:
  -(*e)-DeleteLocalRef(e, finfo);
   return APR_SUCCESS;
   }
   
  -apr_status_t tcn_load_ainfo_class(JNIEnv *e)
  +apr_status_t tcn_load_ainfo_class(JNIEnv *e, jclass ainfo)
   {
  -jclass ainfo;
  -
  -ainfo = (*e)-FindClass(e, TCN_AINFO_CLASS);
  -if (ainfo == NULL) {
  -(*e)-ExceptionClear(e);
  -return APR_EGENERAL;
  -}
  -
   GET_AINFO_J(pool);
   GET_AINFO_S(hostname);
   GET_AINFO_S(servname);
   GET_AINFO_I(port);
   GET_AINFO_I(family);
   GET_AINFO_J(next);
  +ainfo_class_init = (*e)-GetMethodID(e, ainfo,
  +  init, ()V);
   
  +if (ainfo_class_init == NULL)
  +goto cleanup;
   ainfo_class_initialized = 1;
  +ainfo_class = ainfo;
   cleanup:
  -(*e)-DeleteLocalRef(e, ainfo);
   return APR_SUCCESS;
   }
   
  @@ -233,6 +229,30 @@
   return (jint)rv;
   }
   
  +TCN_IMPLEMENT_CALL(jobject, File, getStat)(TCN_STDARGS, jstring fname,
  +   jint wanted, jlong pool)
  +{
  +apr_pool_t *p = J2P(pool, apr_pool_t *);
  +TCN_ALLOC_CSTRING(fname);
  +apr_status_t rv;
  +apr_finfo_t info;
  +jobject finfo = NULL;
  +
  +UNREFERENCED(o);
  +
  +if ((rv =  apr_stat(info, J2S(fname), wanted, p)) == APR_SUCCESS) {
  +finfo = (*e)-NewObject(e, finfo_class, finfo_class_init);
  +if (finfo == NULL)
  +goto cleanup;
  +fill_finfo(e, finfo, info);
  +}
  +else
  +tcn_ThrowAPRException(e, rv);
  +cleanup:
  +TCN_FREE_CSTRING(fname);
  +return finfo;
  +}
  +
   TCN_IMPLEMENT_CALL(jint, File, infoGet)(TCN_STDARGS, jobject finfo,
   jint wanted, jlong file)
   {
  @@ -250,6

cvs commit: jakarta-tomcat-connectors/jni/native/src network.c

2005-06-23 Thread mturk
mturk   2005/06/23 07:10:08

  Modified:jni/native/src network.c
  Log:
  Add missing function wrappers for getting and setting the timeout on
  accepted socket.
  
  Revision  ChangesPath
  1.39  +3 -1  jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- network.c 23 Jun 2005 08:58:05 -  1.38
  +++ network.c 23 Jun 2005 14:10:08 -  1.39
  @@ -444,6 +444,8 @@
   a-send = APR_socket_send;
   a-sendv= APR_socket_sendv;
   a-shutdown = APR_socket_shutdown;
  +a-tmget= APR_socket_timeout_get;
  +a-tmset= APR_socket_timeout_set;
   a-close= NULL;
   a-opaque   = n;
   apr_pool_cleanup_register(p, (const void *)a,
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native configure.in

2005-06-23 Thread mturk
mturk   2005/06/23 07:49:36

  Modified:jni/native configure.in
  Log:
  Use -Wall for maintainer mode if GCC is used.
  
  Revision  ChangesPath
  1.8   +6 -6  jakarta-tomcat-connectors/jni/native/configure.in
  
  Index: configure.in
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/configure.in,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- configure.in  21 Jun 2005 10:31:41 -  1.7
  +++ configure.in  23 Jun 2005 14:49:36 -  1.8
  @@ -135,12 +135,12 @@
   maintainer-mode,
   [  --enable-maintainer-mode   Turn on debugging and compile time warnings],
   [
  -case ${enableval} in
  -y | Y | YES | yes | TRUE | true )
  -CFLAGS=${CFLAGS} -DDEBUG
  -AC_MSG_RESULT([...Enabling Maintainer mode...])
  -;;
  -esac
  +  if test $GCC = yes; then
  +CFLAGS=${CFLAGS} -DDEBUG -Wall
  +  else
  +CFLAGS=${CFLAGS} -DDEBUG
  +  fi  
  +AC_MSG_RESULT([...Enabling Maintainer mode...])
   ])
   
   dnl
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslnetwork.c sslutils.c

2005-06-18 Thread mturk
mturk   2005/06/18 01:01:54

  Modified:jni/native/src sslnetwork.c sslutils.c
  Log:
  Fix compile time warnings.
  
  Revision  ChangesPath
  1.16  +18 -17jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
  
  Index: sslnetwork.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- sslnetwork.c  17 Jun 2005 14:17:00 -  1.15
  +++ sslnetwork.c  18 Jun 2005 08:01:54 -  1.16
  @@ -309,8 +309,9 @@
   }
   
   static apr_status_t APR_THREAD_FUNC
  -ssl_socket_recv(tcn_ssl_conn_t *con, char *buf, apr_size_t *len)
  +ssl_socket_recv(void *sock, char *buf, apr_size_t *len)
   {
  +tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
   int s, rd = (int)(*len);
   apr_status_t rv = APR_SUCCESS;
   
  @@ -355,9 +356,10 @@
   }
   
   static apr_status_t APR_THREAD_FUNC
  -ssl_socket_send(tcn_ssl_conn_t *con, const char *buf,
  +ssl_socket_send(void *sock, const char *buf,
   apr_size_t *len)
   {
  +tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
   int s, rd = (int)(*len);
   apr_status_t rv = APR_SUCCESS;
   
  @@ -397,17 +399,18 @@
   }
   
   static apr_status_t APR_THREAD_FUNC
  -ssl_socket_sendv(tcn_ssl_conn_t *sock,
  +ssl_socket_sendv(void *sock,
const struct iovec *vec,
apr_int32_t nvec, apr_size_t *len)
   {
  +tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
   apr_status_t rv;
   apr_size_t readed = 0;
   apr_int32_t i;
   
   for (i = 0; i  nvec; i++) {
   apr_size_t rd = vec[i].iov_len;
  -if ((rv = ssl_socket_send(sock, vec[i].iov_base, rd)) != 
APR_SUCCESS) {
  +if ((rv = ssl_socket_send(con, vec[i].iov_base, rd)) != 
APR_SUCCESS) {
   *len = readed;
   return rv;
   }
  @@ -419,23 +422,21 @@
   
   
   TCN_IMPLEMENT_CALL(jint, SSLSocket, attach)(TCN_STDARGS, jlong ctx,
  -jlong sock, jlong pool)
  +jlong sock)
   {
   tcn_ssl_ctxt_t *c = J2P(ctx, tcn_ssl_ctxt_t *);
   tcn_socket_t *s   = J2P(sock, tcn_socket_t *);
  -apr_pool_t *p = J2P(pool, apr_pool_t *);
   tcn_ssl_conn_t *con;
   apr_os_sock_t  oss;
   apr_status_t rv;
   
   UNREFERENCED(o);
  -TCN_ASSERT(pool != 0);
   TCN_ASSERT(ctx != 0);
   TCN_ASSERT(sock != 0);
   
   if ((rv = apr_os_sock_get(oss, s-sock)) != APR_SUCCESS)
   return rv;
  -if ((con = ssl_create(e, c, p)) == NULL)
  +if ((con = ssl_create(e, c, s-pool)) == NULL)
   return APR_EGENERAL;
   con-sock = s-sock;
   
  @@ -445,14 +446,14 @@
   else
   SSL_set_connect_state(con-ssl);
   /* Change socket type */
  -s-type = TCN_SOCKET_SSL;
  -s-cleanup  = ssl_cleanup;
  -s-net_recv = ssl_socket_recv;
  -s-net_send = ssl_socket_send;
  -s-net_sendv= ssl_socket_sendv;
  -s-net_shutdown = ssl_socket_shutdown;
  -s-net_close= ssl_socket_close;
  -s-opaque= con;
  +s-type = TCN_SOCKET_SSL;
  +s-cleanup  = ssl_cleanup;
  +s-recv = ssl_socket_recv;
  +s-send = ssl_socket_send;
  +s-sendv= ssl_socket_sendv;
  +s-shutdown = ssl_socket_shutdown;
  +s-close= ssl_socket_close;
  +s-opaque   = con;
   
   return APR_SUCCESS;
   }
  
  
  
  1.30  +1 -3  jakarta-tomcat-connectors/jni/native/src/sslutils.c
  
  Index: sslutils.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslutils.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- sslutils.c17 Jun 2005 09:41:30 -  1.29
  +++ sslutils.c18 Jun 2005 08:01:54 -  1.30
  @@ -336,7 +336,6 @@
   
   RSA *SSL_callback_tmp_RSA(SSL *ssl, int export, int keylen)
   {
  -tcn_ssl_conn_t *conn = (tcn_ssl_conn_t *)SSL_get_app_data(ssl);
   int idx;
   
   /* doesn't matter if export flag is on,
  @@ -372,7 +371,6 @@
*/
   DH *SSL_callback_tmp_DH(SSL *ssl, int export, int keylen)
   {
  -tcn_ssl_conn_t *conn = (tcn_ssl_conn_t *)SSL_get_app_data(ssl);
   int idx;
   switch (keylen) {
   case 512:
  
  
  

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



cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net AprEndpoint.java

2005-06-18 Thread mturk
mturk   2005/06/18 01:03:21

  Modified:jni/examples/org/apache/tomcat/jni Echo.java SSLServer.java
   jni/java/org/apache/tomcat/jni Poll.java SSLSocket.java
Socket.java
   jni/native/include tcn.h
   jni/native/src network.c poll.c
   util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Use auto pool management for Socket.accept.
  On each accept the socket's child pool is created and assigned
  to the accepted socket.
  
  Revision  ChangesPath
  1.14  +2 -2  
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java
  
  Index: Echo.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Echo.java 17 Jun 2005 12:03:51 -  1.13
  +++ Echo.java 18 Jun 2005 08:03:21 -  1.14
  @@ -99,7 +99,7 @@
   int i = 0;
   try {
   while (true) {
  -long clientSock = Socket.accept(serverSock, pool);
  +long clientSock = Socket.accept(serverSock);
   System.out.println(Accepted id:  +  i);
   
   try {
  
  
  
  1.10  +3 -3  
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/SSLServer.java
  
  Index: SSLServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/SSLServer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SSLServer.java17 Jun 2005 12:03:51 -  1.9
  +++ SSLServer.java18 Jun 2005 08:03:21 -  1.10
  @@ -116,7 +116,7 @@
   int i = 0;
   try {
   while (true) {
  -long clientSock = Socket.accept(serverSock, pool);
  +long clientSock = Socket.accept(serverSock);
   System.out.println(Accepted id:  +  i);
   
   try {
  @@ -142,7 +142,7 @@
   }
   
   Socket.timeoutSet(clientSock, 1000);
  -SSLSocket.attach(SSLServer.serverCtx, clientSock, pool);
  +SSLSocket.attach(SSLServer.serverCtx, clientSock);
   i = SSLSocket.handshake(clientSock);
   if (i == 0) {
   
  
  
  
  1.13  +3 -4  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Poll.java
  
  Index: Poll.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Poll.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Poll.java 17 Jun 2005 11:22:04 -  1.12
  +++ Poll.java 18 Jun 2005 08:03:21 -  1.13
  @@ -113,11 +113,10 @@
* Maintain on the descriptor(s) in a pollset
* @param pollset The pollset to use
* @param descriptors Array of signalled descriptors (output parameter)
  - *The desctiptor array must be two times the size of pollset.
  + *The desctiptor array must be the size of pollset.
*and are populated as follows:
* PRE
  - * descriptors[n + 0] - returned events
  - * descriptors[n + 1] - socket
  + * descriptors[n] - socket
* /PRE
* @param remove Remove signaled descriptors from pollset
* @return Number of signalled descriptors (output parameter)
  
  
  
  1.15  +3 -5  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java
  
  Index: SSLSocket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SSLSocket.java17 Jun 2005 12:04:40 -  1.14
  +++ SSLSocket.java18 Jun 2005 08:03:21 -  1.15
  @@ -30,12 +30,10 @@
   /**
* Attach APR socket on a SSL connection.
* @param ctx SSLContext to use.
  - * @param sock APR Socket that already did physical connect.
  - * @param pool The pool to use
  - * @param pool The pool to use
  + * @param sock APR Socket that already did physical connect or accept.
* @return APR_STATUS code.
*/
  -public static native int attach(long ctx, long sock, long pool)
  +public static native int attach(long ctx, long sock)
   throws Exception;
   
   /**
  
  
  
  1.17  +3 -3  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Socket.java
  
  Index: Socket.java
  ===
  RCS file: 
/home/cvs/jakarta

cvs commit: jakarta-tomcat-connectors/jni/native/src network.c

2005-06-18 Thread mturk
mturk   2005/06/18 05:02:51

  Modified:jni/native/src network.c
  Log:
  Add transport metricks when compiled with TRACE support.
  
  Revision  ChangesPath
  1.31  +94 -3 jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- network.c 18 Jun 2005 08:03:21 -  1.30
  +++ network.c 18 Jun 2005 12:02:51 -  1.31
  @@ -27,6 +27,17 @@
   static volatile apr_uint32_t sp_closed   = 0;
   static volatile apr_uint32_t sp_cleared  = 0;
   static volatile apr_uint32_t sp_accepted = 0;
  +static volatile apr_uint32_t sp_max_send = 0;
  +static volatile apr_uint32_t sp_min_send = 1000;
  +static volatile apr_uint32_t sp_num_send = 0;
  +static volatile apr_off_tsp_tot_send = 0;
  +static volatile apr_uint32_t sp_max_recv = 0;
  +static volatile apr_uint32_t sp_min_recv = 1000;
  +static volatile apr_uint32_t sp_num_recv = 0;
  +static volatile apr_off_tsp_tot_recv = 0;
  +static volatile apr_uint32_t sp_err_recv = 0;
  +static volatile apr_uint32_t sp_tmo_recv = 0;
  +
   /* Fake private pool struct to deal with APR private's socket
* struct not exposing function to access the pool.
*/
  @@ -60,6 +71,16 @@
   fprintf(stderr, Sockets accepted: %d\n, sp_accepted);
   fprintf(stderr, Sockets closed  : %d\n, sp_closed);
   fprintf(stderr, Sockets cleared : %d\n, sp_cleared);
  +fprintf(stderr, Total send calls: %d\n, sp_num_send);
  +fprintf(stderr, Minimum send lenght : %d\n, sp_min_send);
  +fprintf(stderr, Maximum send lenght : %d\n, sp_max_send);
  +fprintf(stderr, Average send lenght : %.2f\n, 
(double)sp_tot_send/(double)sp_num_send);
  +fprintf(stderr, Total recv calls: %d\n, sp_num_recv);
  +fprintf(stderr, Minimum recv lenght : %d\n, sp_min_recv);
  +fprintf(stderr, Maximum recv lenght : %d\n, sp_max_recv);
  +fprintf(stderr, Average recv lenght : %.2f\n, 
(double)sp_tot_recv/(double)sp_num_recv);
  +fprintf(stderr, Receive timeouts: %d\n, sp_tmo_recv);
  +fprintf(stderr, Receive errors  : %d\n, sp_err_recv);
   }
   
   #endif
  @@ -399,6 +420,12 @@
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  +#ifdef TCN_DO_STATISTICS
  +sp_max_send = TCN_MAX(sp_max_send, nbytes);
  +sp_min_send = TCN_MIN(sp_min_send, nbytes);
  +sp_tot_send += nbytes;
  +sp_num_send++;
  +#endif
   
   if (tosend = TCN_BUFFER_SZ) {
   char sb[TCN_BUFFER_SZ];
  @@ -438,6 +465,12 @@
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
   TCN_ASSERT(buf != NULL);
  +#ifdef TCN_DO_STATISTICS
  +sp_max_send = TCN_MAX(sp_max_send, nbytes);
  +sp_min_send = TCN_MIN(sp_min_send, nbytes);
  +sp_tot_send += nbytes;
  +sp_num_send++;
  +#endif
   
   bytes  = (char *)(*e)-GetDirectBufferAddress(e, buf);
   ss = (*s-send)(s-opaque, bytes + offset, nbytes);
  @@ -544,6 +577,21 @@
   (*e)-ReleaseByteArrayElements(e, buf, bytes,
  nbytes ? 0 : JNI_ABORT);
   }
  +#ifdef TCN_DO_STATISTICS
  +if (ss == APR_SUCCESS) {
  +sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
  +sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
  +sp_tot_recv += nbytes;
  +sp_num_recv++;
  +}
  +else {
  +if (APR_STATUS_IS_ETIMEDOUT(ss) ||
  +APR_STATUS_IS_TIMEUP(ss))
  +sp_tmo_recv++;
  +else
  +sp_err_recv++;
  +}
  +#endif
   if (ss == APR_SUCCESS)
   return (jint)nbytes;
   else {
  @@ -582,6 +630,21 @@
   }
   /* Resore the original timeout */
   apr_socket_timeout_set(s-sock, t);
  +#ifdef TCN_DO_STATISTICS
  +if (ss == APR_SUCCESS) {
  +sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
  +sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
  +sp_tot_recv += nbytes;
  +sp_num_recv++;
  +}
  +else {
  +if (APR_STATUS_IS_ETIMEDOUT(ss) ||
  +APR_STATUS_IS_TIMEUP(ss))
  +sp_tmo_recv++;
  +else
  +sp_err_recv++;
  +}
  +#endif
   cleanup:
   if (ss == APR_SUCCESS)
   return (jint)nbytes;
  @@ -606,7 +669,21 @@
   bytes  = (char *)(*e)-GetDirectBufferAddress(e, buf);
   TCN_ASSERT(bytes != NULL);
   ss = (*s-recv)(s-opaque, bytes + offset, nbytes);
  -
  +#ifdef TCN_DO_STATISTICS
  +if (ss == APR_SUCCESS) {
  +sp_max_recv = TCN_MAX(sp_max_recv, nbytes);
  +sp_min_recv = TCN_MIN(sp_min_recv, nbytes);
  +sp_tot_recv += nbytes;
  +sp_num_recv++;
  +}
  +else {
  +if (APR_STATUS_IS_ETIMEDOUT(ss) ||
  +APR_STATUS_IS_TIMEUP(ss

cvs commit: jakarta-tomcat-connectors/jni/native configure.in

2005-06-18 Thread mturk
mturk   2005/06/18 06:04:42

  Modified:jni/native configure.in
  Log:
  Add --enable-maintainer-mode to the configure options, so that
  statistics gets compiled in when configure is called with that option.
  
  Revision  ChangesPath
  1.6   +20 -5 jakarta-tomcat-connectors/jni/native/configure.in
  
  Index: configure.in
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/configure.in,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- configure.in  12 Jun 2005 06:10:13 -  1.5
  +++ configure.in  18 Jun 2005 13:04:42 -  1.6
  @@ -12,7 +12,7 @@
   sinclude(build/find_apr.m4)
   
   dnl Generate ./config.nice for reproducing runs of configure
  -dnl 
  +dnl
   APR_CONFIG_NICE(config.nice)
   
   dnl # Some initial steps for configuration.  We setup the default directory
  @@ -94,11 +94,11 @@
   AC_SUBST(JAVA_OS)
   
   APR_ADDTO(TCNATIVE_PRIV_INCLUDES,[-I$JAVA_HOME/include])
  -APR_ADDTO(TCNATIVE_PRIV_INCLUDES,[-I$JAVA_HOME/include/$JAVA_OS]) 
  +APR_ADDTO(TCNATIVE_PRIV_INCLUDES,[-I$JAVA_HOME/include/$JAVA_OS])
   
   dnl
   dnl Detect openssl toolkit installation
  -dnl 
  +dnl
   TCN_CHECK_SSL_TOOLKIT
   
   so_ext=$APR_SO_EXT
  @@ -113,7 +113,7 @@
   host_alias=`uname -s`
   case $host_alias in
   dnl ### BeOS requires that ALL symbols resolve at LINK time!
  -dnl ### 
  +dnl ###
   dnl ### So, if we're building on BeOS then we need to add in the
   dnl ### apr and expat libraries to the build or it'll die a truly 
horrible
   dnl ### death. We now use the apr-config tool to determine the correct
  @@ -128,6 +128,21 @@
   
   AC_SUBST(EXTRA_OS_LINK)
   
  +dnl CFLAGS for maintainer mode
  +dnl it also allows the CFLAGS environment variable.
  +CFLAGS=${CFLAGS}
  +AC_ARG_ENABLE(
  +maintainer-mode,
  +[  --enable-maintainer-mode   Turn on debugging and compile time warnings],
  +[
  +case ${enableval} in
  +y | Y | YES | yes | TRUE | true )
  +CFLAGS=${CFLAGS} -DDEBUG -Wall
  +AC_MSG_RESULT([...Enabling Maintainer mode...])
  +;;
  +esac
  +])
  +
   dnl
   dnl Prep all the flags and stuff for compilation and export to other builds
   dnl
  @@ -178,7 +193,7 @@
   fi
   
   dnl
  -dnl everthing is done. 
  +dnl everthing is done.
   MAKEFILES=Makefile
   AC_OUTPUT([
   tcnative.pc
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src network.c sslnetwork.c

2005-06-18 Thread mturk
mturk   2005/06/18 07:03:09

  Modified:jni/native/include tcn.h
   jni/native/src network.c sslnetwork.c
  Log:
  Use apr_socket_t as proto for socket callback to make compilers
  happy about struct pointers.
  
  Revision  ChangesPath
  1.23  +6 -6  jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- tcn.h 18 Jun 2005 08:03:21 -  1.22
  +++ tcn.h 18 Jun 2005 14:03:09 -  1.23
  @@ -118,11 +118,11 @@
   void *opaque;
   int  type;
   apr_status_t (*cleanup)(void *);
  -apr_status_t (APR_THREAD_FUNC *send) (void *, const char *, apr_size_t 
*);
  -apr_status_t (APR_THREAD_FUNC *sendv)(void *, const struct iovec *, 
apr_int32_t, apr_size_t *);
  -apr_status_t (APR_THREAD_FUNC *recv) (void *, char *, apr_size_t *);
  -apr_status_t (APR_THREAD_FUNC *close) (void *);
  -apr_status_t (APR_THREAD_FUNC *shutdown) (void *, apr_shutdown_how_e);
  +apr_status_t (APR_THREAD_FUNC *send) (apr_socket_t *, const char *, 
apr_size_t *);
  +apr_status_t (APR_THREAD_FUNC *sendv)(apr_socket_t *, const struct iovec 
*, apr_int32_t, apr_size_t *);
  +apr_status_t (APR_THREAD_FUNC *recv) (apr_socket_t *, char *, apr_size_t 
*);
  +apr_status_t (APR_THREAD_FUNC *close) (apr_socket_t *);
  +apr_status_t (APR_THREAD_FUNC *shutdown) (apr_socket_t *, 
apr_shutdown_how_e);
   
   } tcn_socket_t;
   
  
  
  
  1.32  +9 -9  jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- network.c 18 Jun 2005 12:02:51 -  1.31
  +++ network.c 18 Jun 2005 14:03:09 -  1.32
  @@ -188,28 +188,28 @@
   
   #if defined(DEBUG) || defined(_DEBUG)
   static APR_INLINE apr_status_t APR_THREAD_FUNC
  -APR_socket_send(void *sock, const char *buf, apr_size_t *len)
  +APR_socket_send(apr_socket_t *sock, const char *buf, apr_size_t *len)
   {
  -return apr_socket_send((apr_socket_t *)sock, buf, len);
  +return apr_socket_send(sock, buf, len);
   }
   
   static APR_INLINE apr_status_t APR_THREAD_FUNC
  -APR_socket_recv(void *sock, char *buf, apr_size_t *len)
  +APR_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
   {
  -return apr_socket_recv((apr_socket_t *)sock, buf, len);
  +return apr_socket_recv(sock, buf, len);
   }
   
   static APR_INLINE apr_status_t APR_THREAD_FUNC
  -APR_socket_sendv(void *sock, const struct iovec *vec,
  +APR_socket_sendv(apr_socket_t *sock, const struct iovec *vec,
apr_int32_t nvec, apr_size_t *len)
   {
  -return apr_socket_sendv((apr_socket_t *)sock, vec, nvec, len);
  +return apr_socket_sendv(sock, vec, nvec, len);
   }
   
   static APR_INLINE apr_status_t APR_THREAD_FUNC
  -APR_socket_shutdown(void *sock, apr_shutdown_how_e how)
  +APR_socket_shutdown(apr_socket_t *sock, apr_shutdown_how_e how)
   {
  -return apr_socket_shutdown((apr_socket_t *)sock, how);
  +return apr_socket_shutdown(sock, how);
   }
   
   #else
  
  
  
  1.17  +8 -7  jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
  
  Index: sslnetwork.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- sslnetwork.c  18 Jun 2005 08:01:54 -  1.16
  +++ sslnetwork.c  18 Jun 2005 14:03:09 -  1.17
  @@ -206,7 +206,7 @@
   }
   
   static apr_status_t APR_THREAD_FUNC
  -ssl_socket_shutdown(void *sock, apr_shutdown_how_e how)
  +ssl_socket_shutdown(apr_socket_t *sock, apr_shutdown_how_e how)
   {
   apr_status_t rv = APR_SUCCESS;
   tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
  @@ -223,7 +223,7 @@
   }
   
   static apr_status_t APR_THREAD_FUNC
  -ssl_socket_close(void *sock)
  +ssl_socket_close(apr_socket_t *sock)
   {
   tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
   apr_status_t rv = APR_SUCCESS;
  @@ -309,7 +309,7 @@
   }
   
   static apr_status_t APR_THREAD_FUNC
  -ssl_socket_recv(void *sock, char *buf, apr_size_t *len)
  +ssl_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len)
   {
   tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
   int s, rd = (int)(*len);
  @@ -356,7 +356,7 @@
   }
   
   static apr_status_t APR_THREAD_FUNC
  -ssl_socket_send(void *sock, const char *buf,
  +ssl_socket_send(apr_socket_t *sock, const char *buf,
   apr_size_t *len)
   {
   tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock

cvs commit: jakarta-tomcat-connectors/jni/native/src network.c

2005-06-18 Thread mturk
mturk   2005/06/18 07:34:28

  Modified:jni/native/include tcn.h
   jni/native/src network.c
  Log:
  Add more assertions to the network for DEBUG builds.
  
  Revision  ChangesPath
  1.24  +6 -5  jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- tcn.h 18 Jun 2005 14:03:09 -  1.23
  +++ tcn.h 18 Jun 2005 14:34:28 -  1.24
  @@ -107,10 +107,11 @@
   
   #define TCN_GETNET_METHOD(FN)  method_##FN
   
  -#define TCN_SOCKET_APR  0
  -#define TCN_SOCKET_SSL  1
  -#define TCN_SOCKET_UNIX 2
  -#define TCN_SOCKET_NTPIPE   3
  +#define TCN_SOCKET_UNKNOWN  0
  +#define TCN_SOCKET_APR  1
  +#define TCN_SOCKET_SSL  2
  +#define TCN_SOCKET_UNIX 3
  +#define TCN_SOCKET_NTPIPE   4
   
   typedef struct {
   apr_pool_t   *pool;
  
  
  
  1.33  +31 -11jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- network.c 18 Jun 2005 14:03:09 -  1.32
  +++ network.c 18 Jun 2005 14:34:28 -  1.33
  @@ -233,21 +233,24 @@
   GET_S_FAMILY(f, family);
   GET_S_TYPE(t, type);
   
  -TCN_THROW_IF_ERR(apr_socket_create(s,
  - f, t, protocol, p), a);
  -
  +if (family  0) { 
  +TCN_THROW_IF_ERR(apr_socket_create(s,
  + f, t, protocol, p), a);
  +}
   #ifdef TCN_DO_STATISTICS
   sp_created++;
   #endif
   a = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
   a-sock = s;
   a-pool = p;
  -a-type = TCN_SOCKET_APR;
  -a-recv = APR_socket_recv;
  -a-send = APR_socket_send;
  -a-sendv= APR_socket_sendv;
  -a-shutdown = APR_socket_shutdown;
  -a-close= NULL;
  +if (family  0) { 
  +a-type = TCN_SOCKET_APR;
  +a-recv = APR_socket_recv;
  +a-send = APR_socket_send;
  +a-sendv= APR_socket_sendv;
  +a-shutdown = APR_socket_shutdown;
  +a-close= NULL;
  +}
   a-opaque   = s;
   apr_pool_cleanup_register(p, (const void *)a,
 sp_socket_cleanup,
  @@ -262,6 +265,7 @@
   {
   tcn_socket_t *s = J2P(sock, tcn_socket_t *);
   UNREFERENCED_STDARGS;
  +TCN_ASSERT(sock != 0);
   apr_pool_destroy(s-pool);
   }
   
  @@ -271,6 +275,7 @@
   apr_pool_t *n;
   
   UNREFERENCED(o);
  +TCN_ASSERT(sock != 0);
   TCN_THROW_IF_ERR(apr_pool_create(n, s-pool), n);
   cleanup:
   return P2J(n);
  @@ -313,6 +318,7 @@
   
   UNREFERENCED_STDARGS;
   TCN_ASSERT(sock != 0);
  +TCN_ASSERT(s-sock != NULL);
   return (jint)apr_socket_bind(s-sock, a);
   }
   
  @@ -323,6 +329,7 @@
   
   UNREFERENCED_STDARGS;
   TCN_ASSERT(sock != 0);
  +TCN_ASSERT(s-sock != NULL);
   return (jint)apr_socket_listen(s-sock, backlog);
   }
   
  @@ -336,6 +343,7 @@
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  +TCN_ASSERT(s-sock != NULL);
   
   TCN_THROW_IF_ERR(apr_socket_accept(n, s-sock, p), n);
   
  @@ -371,6 +379,7 @@
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  +TCN_ASSERT(s-sock != NULL);
   
   TCN_THROW_IF_ERR(apr_pool_create(p, s-pool), p);
   TCN_THROW_IF_ERR(apr_socket_accept(n, s-sock, p), n);
  @@ -408,6 +417,7 @@
   
   UNREFERENCED_STDARGS;
   TCN_ASSERT(sock != 0);
  +TCN_ASSERT(s-sock != NULL);
   return (jint)apr_socket_connect(s-sock, a);
   }
   
  @@ -420,6 +430,7 @@
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  +TCN_ASSERT(s-sock != NULL);
   #ifdef TCN_DO_STATISTICS
   sp_max_send = TCN_MAX(sp_max_send, nbytes);
   sp_min_send = TCN_MIN(sp_min_send, nbytes);
  @@ -430,7 +441,7 @@
   if (tosend = TCN_BUFFER_SZ) {
   char sb[TCN_BUFFER_SZ];
   (*e)-GetByteArrayRegion(e, buf, offset, tosend, (jbyte *)sb);
  -ss = apr_socket_send(s-sock, sb, nbytes);
  +ss = (*s-send)(s-opaque, sb, nbytes);
   }
   else {
   jbyte *bytes;
  @@ -533,6 +544,7 @@
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  +TCN_ASSERT(s-sock != NULL);
   
   bytes = (*e)-GetByteArrayElements(e, buf, NULL);
   TCN_ASSERT(bytes != NULL);
  @@ -611,6 +623,7 @@
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  +TCN_ASSERT(s-sock != NULL);
   TCN_ASSERT(buf != NULL);
   
   if ((ss = apr_socket_timeout_get(s-sock, t)) != APR_SUCCESS)
  @@ -705,6 +718,7 @@
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
   TCN_ASSERT

cvs commit: jakarta-tomcat-connectors/jni/native/src network.c

2005-06-18 Thread mturk
mturk   2005/06/18 08:35:44

  Modified:jni/native/src network.c
  Log:
  APR_EOF is also the 'reset' event caused by remote closing the socket.
  
  Revision  ChangesPath
  1.35  +23 -9 jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- network.c 18 Jun 2005 15:10:22 -  1.34
  +++ network.c 18 Jun 2005 15:35:44 -  1.35
  @@ -38,6 +38,7 @@
   static volatile apr_uint32_t sp_err_recv = 0;
   static volatile apr_uint32_t sp_tmo_recv = 0;
   static volatile apr_uint32_t sp_rst_recv = 0;
  +static volatile apr_status_t sp_erl_recv = 0;
   
   /* Fake private pool struct to deal with APR private's socket
* struct not exposing function to access the pool.
  @@ -83,6 +84,7 @@
   fprintf(stderr, Receive timeouts: %d\n, sp_tmo_recv);
   fprintf(stderr, Receive errors  : %d\n, sp_err_recv);
   fprintf(stderr, Receive resets  : %d\n, sp_rst_recv);
  +fprintf(stderr, Last receive error  : %d\n, sp_erl_recv);
   }
   
   #endif
  @@ -603,10 +605,13 @@
   APR_STATUS_IS_TIMEUP(ss))
   sp_tmo_recv++;
   else if (APR_STATUS_IS_ECONNABORTED(ss) ||
  - APR_STATUS_IS_ECONNRESET(ss))
  + APR_STATUS_IS_ECONNRESET(ss) ||
  + APR_STATUS_IS_EOF(ss))
   sp_rst_recv++;
  -else
  +else {
   sp_err_recv++;
  +sp_erl_recv = ss;
  +}
   }
   #endif
   if (ss == APR_SUCCESS)
  @@ -660,10 +665,13 @@
   APR_STATUS_IS_TIMEUP(ss))
   sp_tmo_recv++;
   else if (APR_STATUS_IS_ECONNABORTED(ss) ||
  - APR_STATUS_IS_ECONNRESET(ss))
  + APR_STATUS_IS_ECONNRESET(ss) ||
  + APR_STATUS_IS_EOF(ss))
   sp_rst_recv++;
  -else
  +else {
   sp_err_recv++;
  +sp_erl_recv = ss;
  +}
   }
   #endif
   cleanup:
  @@ -702,10 +710,13 @@
   APR_STATUS_IS_TIMEUP(ss))
   sp_tmo_recv++;
   else if (APR_STATUS_IS_ECONNABORTED(ss) ||
  - APR_STATUS_IS_ECONNRESET(ss))
  + APR_STATUS_IS_ECONNRESET(ss) ||
  + APR_STATUS_IS_EOF(ss))
   sp_rst_recv++;
  -else
  +else {
   sp_err_recv++;
  +sp_erl_recv = ss;
  +}
   }
   #endif
   if (ss == APR_SUCCESS)
  @@ -753,10 +764,13 @@
   APR_STATUS_IS_TIMEUP(ss))
   sp_tmo_recv++;
   else if (APR_STATUS_IS_ECONNABORTED(ss) ||
  - APR_STATUS_IS_ECONNRESET(ss))
  + APR_STATUS_IS_ECONNRESET(ss) ||
  + APR_STATUS_IS_EOF(ss))
   sp_rst_recv++;
  -else
  +else {
   sp_err_recv++;
  +sp_erl_recv = ss;
  +}
   }
   #endif
   if (ss == APR_SUCCESS)
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src network.c

2005-06-18 Thread mturk
mturk   2005/06/18 09:07:59

  Modified:jni/native/src network.c
  Log:
  Remove fake apr_socket_t struct. It is not needed any more.
  
  Revision  ChangesPath
  1.36  +1 -8  jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- network.c 18 Jun 2005 15:35:44 -  1.35
  +++ network.c 18 Jun 2005 16:07:59 -  1.36
  @@ -40,13 +40,6 @@
   static volatile apr_uint32_t sp_rst_recv = 0;
   static volatile apr_status_t sp_erl_recv = 0;
   
  -/* Fake private pool struct to deal with APR private's socket
  - * struct not exposing function to access the pool.
  - */
  -typedef struct
  -{
  -apr_pool_t *pool;
  -} fake_apr_socket_t;
   #endif
   
   #if  !APR_HAVE_IPV6
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src network.c

2005-06-18 Thread mturk
mturk   2005/06/18 09:36:15

  Modified:jni/java/org/apache/tomcat/jni Socket.java
   jni/native/include tcn.h
   jni/native/src network.c
  Log:
  Add Socket.get method for obtaining private struct members.
  
  Revision  ChangesPath
  1.18  +21 -1 
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Socket.java
  
  Index: Socket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Socket.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Socket.java   18 Jun 2005 08:03:21 -  1.17
  +++ Socket.java   18 Jun 2005 16:36:15 -  1.18
  @@ -97,6 +97,12 @@
   public static final int APR_LOCAL  = 0;
   public static final int APR_REMOTE = 1;
   
  +/* Socket.get types */
  +public static final int SOCKET_GET_POOL = 0;
  +public static final int SOCKET_GET_IMPL = 1;
  +public static final int SOCKET_GET_APRS = 2;
  +public static final int SOCKET_GET_TYPE = 3;
  +
   /**
* Create a socket.
* @param family The address family of the socket (e.g., APR_INET).
  @@ -468,4 +474,18 @@
   public static native long pool(long thesocket)
   throws Exception;
   
  +/**
  + * Private method for geting the socket struct members
  + * @param socket The soocket to use
  + * @param what Struct member to obtain
  + * PRE
  + * SOCKET_GET_POOL  - The socket pool
  + * SOCKET_GET_IMPL  - The socket implementation object
  + * SOCKET_GET_APRS  - APR socket
  + * SOCKET_GET_TYPE  - Socket type
  + * /PRE
  + * @return The stucture member address
  + */
  +private static native long get(long socket, int what);
  +
   }
  
  
  
  1.25  +6 -1  jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- tcn.h 18 Jun 2005 14:34:28 -  1.24
  +++ tcn.h 18 Jun 2005 16:36:15 -  1.25
  @@ -113,6 +113,11 @@
   #define TCN_SOCKET_UNIX 3
   #define TCN_SOCKET_NTPIPE   4
   
  +#define TCN_SOCKET_GET_POOL 0
  +#define TCN_SOCKET_GET_IMPL 1
  +#define TCN_SOCKET_GET_APRS 2
  +#define TCN_SOCKET_GET_TYPE 3
  +
   typedef struct {
   apr_pool_t   *pool;
   apr_socket_t *sock;
  
  
  
  1.37  +24 -1 jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- network.c 18 Jun 2005 16:07:59 -  1.36
  +++ network.c 18 Jun 2005 16:36:15 -  1.37
  @@ -278,6 +278,29 @@
   return P2J(n);
   }
   
  +TCN_IMPLEMENT_CALL(jlong, Socket, get)(TCN_STDARGS, jlong sock, jint what)
  +{
  +tcn_socket_t *s = J2P(sock, tcn_socket_t *);
  +UNREFERENCED_STDARGS;
  +TCN_ASSERT(sock != 0);
  +
  +switch (what) {
  +case TCN_SOCKET_GET_POOL:
  +return P2J(s-pool);
  +break;
  +case TCN_SOCKET_GET_IMPL:
  +return P2J(s-opaque);
  +break;
  +case TCN_SOCKET_GET_APRS:
  +return P2J(s-sock);
  +break;
  +case TCN_SOCKET_GET_TYPE:
  +return P2J(s-type);
  +break;
  +}
  +return 0;
  +}
  +
   TCN_IMPLEMENT_CALL(jint, Socket, shutdown)(TCN_STDARGS, jlong sock,
  jint how)
   {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net AprEndpoint.java

2005-06-17 Thread mturk
mturk   2005/06/17 02:43:35

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java Http11AprProtocol.java
   jk/java/org/apache/coyote/ajp AjpAprProcessor.java
AjpAprProtocol.java
   util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Implement new socket abstraction.
  We don't need to maintain the pool, so the poll size can be half the size.
  
  Revision  ChangesPath
  1.15  +3 -3  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Http11AprProcessor.java   26 May 2005 09:06:16 -  1.14
  +++ Http11AprProcessor.java   17 Jun 2005 09:43:35 -  1.15
  @@ -729,7 +729,7 @@
*
* @throws IOException error during an I/O operation
*/
  -public boolean process(long socket, long pool)
  +public boolean process(long socket)
   throws IOException {
   ThreadWithAttributes thrA=
   (ThreadWithAttributes)Thread.currentThread();
  @@ -779,7 +779,7 @@
   rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
   openSocket = true;
   // Add the socket to the poller
  -endpoint.getPoller().add(socket, pool);
  +endpoint.getPoller().add(socket);
   break;
   }
   request.setStartTime(System.currentTimeMillis());
  @@ -884,7 +884,7 @@
   // Do sendfile as needed: add socket to sendfile and end
   if (sendfileData != null) {
   sendfileData.socket = socket;
  -sendfileData.pool = pool;
  +sendfileData.pool = 0;
   if (!endpoint.getSendfile().add(sendfileData)) {
   keepAlive = false;
   }
  
  
  
  1.9   +2 -2  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProtocol.java
  
  Index: Http11AprProtocol.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProtocol.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Http11AprProtocol.java27 May 2005 15:40:23 -  1.8
  +++ Http11AprProtocol.java17 Jun 2005 09:43:35 -  1.9
  @@ -664,7 +664,7 @@
   return  thData;
   }
   
  -public boolean process(long socket, long pool) {
  +public boolean process(long socket) {
   Http11AprProcessor processor=null;
   try {
   // FIXME: It is also possible to use the TWA data, so keep 
init() [] for
  @@ -696,7 +696,7 @@
   processor.setSocket( socket );
   */
   
  -return processor.process(socket, pool);
  +return processor.process(socket);
   
   } catch(java.net.SocketException e) {
   // SocketExceptions are normal
  
  
  
  1.5   +2 -2  
jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java
  
  Index: AjpAprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AjpAprProcessor.java  16 Jun 2005 11:52:26 -  1.4
  +++ AjpAprProcessor.java  17 Jun 2005 09:43:35 -  1.5
  @@ -352,7 +352,7 @@
*
* @throws IOException error during an I/O operation
*/
  -public boolean process(long socket, long pool)
  +public boolean process(long socket)
   throws IOException {
   ThreadWithAttributes thrA=
   (ThreadWithAttributes)Thread.currentThread();
  @@ -464,7 +464,7 @@
   
   // Add the socket to the poller
   if (!error) {
  -endpoint.getPoller().add(socket, pool);
  +endpoint.getPoller().add(socket);
   } else {
   openSocket = false;
   }
  
  
  
  1.2   +2 -2  
jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpAprProtocol.java
  
  Index: AjpAprProtocol.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpAprProtocol.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AjpAprProtocol.java   9 Jun 2005 16:14:51

cvs commit: jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni Echo.java SSLServer.java BIOSSLServer.java

2005-06-17 Thread mturk
mturk   2005/06/17 05:03:51

  Modified:jni/examples/org/apache/tomcat/jni Echo.java SSLServer.java
  Removed: jni/examples/org/apache/tomcat/jni BIOSSLServer.java
  Log:
  Update examples and remove BIOSSLServer because now
  it needs a total rewrite.
  
  Revision  ChangesPath
  1.13  +2 -2  
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java
  
  Index: Echo.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Echo.java 17 Jun 2005 11:23:33 -  1.12
  +++ Echo.java 17 Jun 2005 12:03:51 -  1.13
  @@ -242,7 +242,7 @@
   while (Socket.recv(clientSock, buf, 0, 1) == 1) {
   if (buf[0] == '\n')
   break;
  -else if (buf[0] == 'Q') {
  +else if (buf[0] == '!') {
   doClose = true;
   break;
   }
  
  
  
  1.9   +7 -6  
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/SSLServer.java
  
  Index: SSLServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/SSLServer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SSLServer.java17 Jun 2005 11:23:33 -  1.8
  +++ SSLServer.java17 Jun 2005 12:03:51 -  1.9
  @@ -142,11 +142,11 @@
   }
   
   Socket.timeoutSet(clientSock, 1000);
  -long sslSocket = SSLSocket.attach(SSLServer.serverCtx, 
clientSock, pool);
  -i = SSLSocket.handshake(sslSocket);
  +SSLSocket.attach(SSLServer.serverCtx, clientSock, pool);
  +i = SSLSocket.handshake(clientSock);
   if (i == 0) {
   
  -Worker worker = new Worker(sslSocket, i++,
  +Worker worker = new Worker(clientSock, i++,
  
this.getClass().getName());
   SSLServer.incThreads();
   worker.start();
  @@ -154,7 +154,7 @@
   }
   else {
   System.out.println(Handshake error:  + 
SSL.getLastError());
  -Socket.destroy(sslSocket);
  +Socket.destroy(clientSock);
   }
   }
   }
  @@ -186,10 +186,11 @@
   while (Socket.recv(clientSock, buf, 0, 1) == 1) {
   if (buf[0] == '\n')
   break;
  -else if (buf[0] == 'Q') {
  +else if (buf[0] == '!') {
   doClose = true;
   break;
   }
  +Socket.send(clientSock, buf, 0, 1);
   }
   if (doClose) {
   try {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslnetwork.c

2005-06-17 Thread mturk
mturk   2005/06/17 05:04:40

  Modified:jni/java/org/apache/tomcat/jni SSLSocket.java
   jni/native/src sslnetwork.c
  Log:
  Fix bug not setting the opaque for SSL socket.
  Attach now returns the status code, not new socket.
  
  Revision  ChangesPath
  1.14  +3 -3  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java
  
  Index: SSLSocket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SSLSocket.java17 Jun 2005 11:22:04 -  1.13
  +++ SSLSocket.java17 Jun 2005 12:04:40 -  1.14
  @@ -33,9 +33,9 @@
* @param sock APR Socket that already did physical connect.
* @param pool The pool to use
* @param pool The pool to use
  - * @return The new socket that has been set up.
  + * @return APR_STATUS code.
*/
  -public static native long attach(long ctx, long sock, long pool)
  +public static native int attach(long ctx, long sock, long pool)
   throws Exception;
   
   /**
  
  
  
  1.14  +9 -149jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
  
  Index: sslnetwork.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- sslnetwork.c  17 Jun 2005 11:22:30 -  1.13
  +++ sslnetwork.c  17 Jun 2005 12:04:40 -  1.14
  @@ -245,147 +245,6 @@
   return (jint)rv;
   }
   
  -#define JFC_TEST 0
  -#if JFC_TEST
  -/*
  - * Use APR sockets directly
  - */
  -
  -static int jbs_apr_new(BIO *bi)
  -{
  -printf(jbs_apr_new\n);
  -fflush(stdout);
  -bi-shutdown = 1;
  -bi-init = 0;
  -bi-num  = -1;
  -bi-ptr  = NULL;
  -return 1;
  -}
  -
  -static int jbs_apr_free(BIO *bi)
  -{
  -if (bi == NULL)
  -return 0;
  -else
  -return 1;
  -}
  -
  -static int jbs_apr_write(BIO *b, const char *in, int inl)
  -{
  -apr_size_t j = inl;
  -apr_socket_t *sock=b-ptr;
  -printf(jbs_apr_write\n);
  -fflush(stdout);
  -return(apr_socket_send(sock, in, j));
  -}
  -
  -static int jbs_apr_read(BIO *b, char *out, int outl)
  -{
  -apr_size_t j = outl;
  -apr_socket_t *sock=b-ptr;
  -int ret;
  -printf(jbs_apr_read\n);
  -fflush(stdout);
  -ret = apr_socket_recv(sock, out, j);
  -if (ret == APR_SUCCESS)
  -  return(j);
  -return(-1);
  -}
  -
  -static int jbs_apr_puts(BIO *b, const char *in)
  -{
  -return 0;
  -}
  -
  -static int jbs_apr_gets(BIO *b, char *out, int outl)
  -{
  -return 0;
  -}
  -
  -static long jbs_apr_ctrl(BIO *b, int cmd, long num, void *ptr)
  -{
  -printf(jbs_apr_ctrl\n);
  -fflush(stdout);
  -if (cmd==BIO_CTRL_FLUSH || cmd==BIO_CTRL_DUP)
  -  return 1;
  -else
  -  return 0;
  -}
  -static BIO_METHOD jbs_apr_methods = {
  -BIO_TYPE_FILE,
  -APR Callback,
  -jbs_apr_write,
  -jbs_apr_read,
  -jbs_apr_puts,
  -jbs_apr_gets,
  -jbs_apr_ctrl,
  -jbs_apr_new,
  -jbs_apr_free,
  -NULL
  -};
  -static BIO_METHOD *BIO_jbs_apr()
  -{
  -return(jbs_apr_methods);
  -}
  -
  -TCN_IMPLEMENT_CALL(jint, SSLSocket, geterror)(TCN_STDARGS, jlong ctx, jint 
retcode)
  -{
  -tcn_ssl_conn_t *c = J2P(ctx, tcn_ssl_conn_t *);
  -UNREFERENCED_STDARGS;
  -TCN_ASSERT(ctx != 0);
  -printf(geterror for %d state: %.08x\n, retcode, c-ssl-state);
  -perror(geterror);
  -fflush(stdout);
  -return SSL_get_error(c-ssl, retcode);
  -}
  -
  -TCN_IMPLEMENT_CALL(jlong, SSLSocket, accept)(TCN_STDARGS, jlong ctx,
  - jlong sock, jlong pool)
  -{
  -tcn_ssl_ctxt_t *c = J2P(ctx, tcn_ssl_ctxt_t *);
  -apr_socket_t *s   = J2P(sock, apr_socket_t *);
  -apr_pool_t *p = J2P(pool, apr_pool_t *);
  -tcn_ssl_conn_t *con;
  -BIO *bio = NULL;
  -int retcode;
  -
  -UNREFERENCED(o);
  -TCN_ASSERT(pool != 0);
  -TCN_ASSERT(ctx != 0);
  -TCN_ASSERT(sock != 0);
  -
  -if ((con = ssl_create(e, c, p)) == NULL) {
  -tcn_ThrowException(e, Create SSL failed);
  -return 0;
  -}
  -con-sock = s;
  -
  -if ((bio = BIO_new(BIO_jbs_apr())) == NULL) {
  -tcn_ThrowException(e, Create BIO failed);
  -return 0;
  -}
  -bio-ptr = s;
  -
  -/* XXX cleanup ??? */
  -
  -/* the bio */
  -SSL_set_bio(con-ssl, bio, bio);
  -
  -/* do the handshake*/
  -retcode = SSL_accept(con-ssl);
  -if (retcode=0) {
  -printf(SSL_accept failed %d state: %.08x\n, retcode, 
con-ssl-state);
  -printf(SSL_accept %p cert\n, con-ssl-cert

cvs commit: jakarta-tomcat-connectors/jni/native/src network.c sslnetwork.c

2005-06-17 Thread mturk
mturk   2005/06/17 04:22:30

  Modified:jni/native/include tcn.h
   jni/native/src network.c sslnetwork.c
  Log:
  Update SSL socket functions as pointers to the socket implementation.
  
  Revision  ChangesPath
  1.20  +4 -8  jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- tcn.h 17 Jun 2005 09:41:30 -  1.19
  +++ tcn.h 17 Jun 2005 11:22:30 -  1.20
  @@ -96,7 +96,7 @@
   /* On stack buffer size */
   #define TCN_BUFFER_SZ   8192
   #define TCN_STDARGS JNIEnv *e, jobject o
  -#define TCN_IMPARGS JNIEnv *e, jobject o, void *opaque
  +#define TCN_IMPARGS JNIEnv *e, jobject o, void *sock
   #define TCN_IMPCALL(X)  e, o, X-opaque
   
   #define TCN_IMPLEMENT_CALL(RT, CL, FN)  \
  @@ -105,21 +105,17 @@
   #define TCN_IMPLEMENT_METHOD(RT, FN)\
   static RT method_##FN
   
  +#define TCN_GETNET_METHOD(FN)  method_##FN
  +
   #define TCN_SOCKET_APR  1
   #define TCN_SOCKET_SSL  2
   #define TCN_SOCKET_UNIX 4
   #define TCN_SOCKET_NTPIPE   5
   
  -#define TCN_SOCKET_APR_NAPR socket
  -#define TCN_SOCKET_SSL_NSSL socket
  -#define TCN_SOCKET_UNIX_N   UNIX local socket
  -#define TCN_SOCKET_NTPIPE_N NT named pipe
  -
   typedef struct {
   apr_pool_t   *pool;
   apr_socket_t *sock;
   void *opaque;
  -const char   *name;
   int  type;
   apr_status_t (*cleanup)(void *opaque);
   jint (*shutdown)(TCN_IMPARGS, jint how);
  
  
  
  1.28  +13 -7 jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- network.c 17 Jun 2005 09:41:30 -  1.27
  +++ network.c 17 Jun 2005 11:22:30 -  1.28
  @@ -189,7 +189,6 @@
   a-sock = s;
   a-pool = p;
   a-type = TCN_SOCKET_APR;
  -a-name = TCN_SOCKET_APR_N;
   apr_pool_cleanup_register(p, (const void *)a,
 sp_socket_cleanup,
 apr_pool_cleanup_null);
  @@ -225,7 +224,7 @@
   UNREFERENCED_STDARGS;
   TCN_ASSERT(sock != 0);
   if (s-shutdown)
  -return (jint)(*s-shutdown)(TCN_IMPCALL(s), how);
  +return (*s-shutdown)(TCN_IMPCALL(s), how);
   else
   return (jint)apr_socket_shutdown(s-sock, (apr_shutdown_how_e)how);
   }
  @@ -233,14 +232,20 @@
   TCN_IMPLEMENT_CALL(jint, Socket, close)(TCN_STDARGS, jlong sock)
   {
   tcn_socket_t *s = J2P(sock, tcn_socket_t *);
  -
  +jint rv = APR_SUCCESS;
   UNREFERENCED_STDARGS;
   TCN_ASSERT(sock != 0);
   
   #ifdef TCN_DO_STATISTICS
   apr_atomic_inc32(sp_closed);
   #endif
  -return (jint)apr_pool_cleanup_run(s-pool, s, sp_socket_cleanup);
  +if (s-close)
  +rv = (*s-close)(TCN_IMPCALL(s));
  +if (s-sock) {
  +rv = (jint)apr_socket_close(s-sock);
  +s-sock = NULL;
  +}
  +return rv;
   }
   
   TCN_IMPLEMENT_CALL(jint, Socket, bind)(TCN_STDARGS, jlong sock,
  @@ -285,7 +290,6 @@
   a-sock = n;
   a-pool = p;
   a-type = TCN_SOCKET_APR;
  -a-name = TCN_SOCKET_APR_N;
   apr_pool_cleanup_register(p, (const void *)a,
 sp_socket_cleanup,
 apr_pool_cleanup_null);
  @@ -689,7 +693,9 @@
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
   TCN_ASSERT(file != 0);
  -
  +
  +if (s-type != TCN_SOCKET_APR)
  +return (jint)(-APR_ENOTIMPL);
   if (headers)
   nh = (*e)-GetArrayLength(e, headers);
   if (trailers)
  
  
  
  1.13  +75 -84jakarta-tomcat-connectors/jni/native/src/sslnetwork.c
  
  Index: sslnetwork.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslnetwork.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- sslnetwork.c  17 Jun 2005 09:41:30 -  1.12
  +++ sslnetwork.c  17 Jun 2005 11:22:30 -  1.13
  @@ -91,7 +91,7 @@
   return rc;
   }
   
  -static apr_status_t ssl_socket_cleanup(void *data)
  +TCN_IMPLEMENT_METHOD(apr_status_t, cleanup)(void *data)
   {
   tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)data;
   
  @@ -105,10 +105,6 @@
   X509_free(con-peer);
   con-peer = NULL;
   }
  -if (con-sock) {
  -apr_socket_close(con-sock);
  -con-sock = NULL;
  -}
   }
   
   #ifdef TCN_DO_STATISTICS
  @@ -140,9 +136,6 @@
   con

cvs commit: jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni Echo.java SSLServer.java

2005-06-17 Thread mturk
mturk   2005/06/17 04:23:33

  Modified:jni/examples/org/apache/tomcat/jni Echo.java SSLServer.java
  Log:
  Update examples.
  
  Revision  ChangesPath
  1.12  +13 -14
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java
  
  Index: Echo.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/Echo.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Echo.java 28 May 2005 12:13:02 -  1.11
  +++ Echo.java 17 Jun 2005 11:23:33 -  1.12
  @@ -153,23 +153,23 @@
   }
   }
   
  -public void add(long socket, int workerId) {
  -int rv = Poll.add(serverPollset, socket, workerId,
  +public void add(long socket) {
  +int rv = Poll.add(serverPollset, socket,
 Poll.APR_POLLIN);
   if (rv == Status.APR_SUCCESS) {
  -System.out.println(Added worker  + workerId +  to 
pollset);
  +System.out.println(Added worker to pollset);
   nsocks++;
   }
   }
   
  -public void remove(long socket, int workerId) {
  +public void remove(long socket) {
   int rv = Poll.remove(serverPollset, socket);
   if (rv == Status.APR_SUCCESS) {
  nsocks--;
  -   System.out.println(Removed worker  + workerId +  from 
pollset);
  +   System.out.println(Removed worker from pollset);
   }
   else {
  -   System.out.println(Failed removing worker  + workerId +  
from pollset);
  +   System.out.println(Failed removing worker from pollset);
   }
   }
   
  @@ -180,17 +180,16 @@
   Thread.sleep(1);
   continue;
   }
  -/* Four times size then  created pollset */
  +/* Two times size then  created pollset */
   long [] desc = new long[64];
   /* USe 1 second poll timeout */
   int rv = Poll.poll(serverPollset, 100, desc, false);
   if (rv  0) {
   for (int n = 0; n  rv; n++) {
  -long clientSock = desc[n*4+1];
  -int  workerId   = (int)desc[n*4+2];
  -System.out.println(Poll flags  + desc[n*4]);
  -remove(clientSock, workerId);
  -Worker worker = new Worker(clientSock, workerId,
  +long clientSock = desc[n*2+1];
  +System.out.println(Poll flags  + desc[n*2]);
  +remove(clientSock);
  +Worker worker = new Worker(clientSock, n,
  
this.getClass().getName());
   Echo.incThreads();
   worker.start();
  @@ -262,7 +261,7 @@
   Socket.send(clientSock, msg, 0, msg.length);
   } catch(Exception e) { }
   /* Put the socket to the keep-alive poll */
  -Echo.echoPoller.add(clientSock, workerId);
  +Echo.echoPoller.add(clientSock);
   }
   } catch (Exception e) {
   Socket.close(clientSock);
  
  
  
  1.8   +14 -12
jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/SSLServer.java
  
  Index: SSLServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/examples/org/apache/tomcat/jni/SSLServer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SSLServer.java15 Jun 2005 15:15:54 -  1.7
  +++ SSLServer.java17 Jun 2005 11:23:33 -  1.8
  @@ -154,7 +154,7 @@
   }
   else {
   System.out.println(Handshake error:  + 
SSL.getLastError());
  -SSLSocket.close(sslSocket);
  +Socket.destroy(sslSocket);
   }
   }
   }
  @@ -179,27 +179,29 @@
   public void run() {
   boolean doClose = false;
   try {
  -SSLSocket.send(clientSock, wellcomeMsg, 0, 
wellcomeMsg.length);
  +Socket.send(clientSock, wellcomeMsg, 0, wellcomeMsg.length);
   while (!doClose) {
   /* Do a blocking read byte at a time */
   byte [] buf = new byte[1];
  -int ret;
  -ret = SSLSocket.recv(clientSock, buf, 0, 1

cvs commit: jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni Poll.java SSLSocket.java

2005-06-17 Thread mturk
mturk   2005/06/17 04:22:04

  Modified:jni/java/org/apache/tomcat/jni Poll.java SSLSocket.java
  Log:
  Update SSL socket functions as pointers to the socket implementation.
  
  Revision  ChangesPath
  1.12  +4 -10 
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Poll.java
  
  Index: Poll.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Poll.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Poll.java 17 Jun 2005 09:41:30 -  1.11
  +++ Poll.java 17 Jun 2005 11:22:04 -  1.12
  @@ -96,13 +96,11 @@
* @param pollset The pollset to use
* @param timeout Timeout in microseconds
* @param descriptors Array of signalled descriptors (output parameter)
  - *The desctiptor array must be four times the size of pollset.
  + *The desctiptor array must be two times the size of pollset.
*and are populated as follows:
* PRE
* descriptors[n + 0] - returned events
* descriptors[n + 1] - socket
  - * descriptors[n + 2] - client data
  - * descriptors[n + 2] - reserved
* /PRE
* @param remove Remove signaled descriptors from pollset
* @return Number of signalled descriptors (output parameter)
  @@ -115,13 +113,11 @@
* Maintain on the descriptor(s) in a pollset
* @param pollset The pollset to use
* @param descriptors Array of signalled descriptors (output parameter)
  - *The desctiptor array must be four times the size of pollset.
  + *The desctiptor array must be two times the size of pollset.
*and are populated as follows:
* PRE
* descriptors[n + 0] - returned events
* descriptors[n + 1] - socket
  - * descriptors[n + 2] - client data
  - * descriptors[n + 2] - reserved
* /PRE
* @param remove Remove signaled descriptors from pollset
* @return Number of signalled descriptors (output parameter)
  @@ -148,13 +144,11 @@
* Return all descriptor(s) in a pollset
* @param pollset The pollset to use
* @param descriptors Array of descriptors (output parameter)
  - *The desctiptor array must be four times the size of pollset.
  + *The desctiptor array must be two times the size of pollset.
*and are populated as follows:
* PRE
* descriptors[n + 0] - returned events
* descriptors[n + 1] - socket
  - * descriptors[n + 2] - client data
  - * descriptors[n + 2] - reserved
* /PRE
* @return Number of descriptors (output parameter) in the Poll
* or negative APR error code.
  
  
  
  1.13  +2 -191
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java
  
  Index: SSLSocket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SSLSocket.java15 Jun 2005 12:08:02 -  1.12
  +++ SSLSocket.java17 Jun 2005 11:22:04 -  1.13
  @@ -40,200 +40,11 @@
   
   /**
* Do a SSL handshake.
  - * @param thesocket The socket to close
  + * @param thesocket The socket to use
*/
   public static native int handshake(long thesocket);
   
   /**
  - * Shutdown a socket.
  - * br /
  - * This does not actually close the socket descriptor, it just
  - *  controls which calls are still valid on the socket.
  - * @param thesocket The socket to close
  - * @param how How to shutdown the socket.  One of:
  - * PRE
  - * SSL_SHUTDOWN_TYPE_UNSET
  - * SSL_SHUTDOWN_TYPE_STANDARD
  - * SSL_SHUTDOWN_TYPE_UNCLEAN
  - * SSL_SHUTDOWN_TYPE_ACCURATE
  - * /PRE
  - * If SSL_SHUTDOWN_TYPE_UNSET is used the default context shutdown
  - * type is used.
  - */
  -public static native int shutdown(long thesocket, int how);
  -
  -/**
  - * Close a socket.
  - * @param thesocket The socket to close
  - */
  -public static native int close(long thesocket);
  -
  -/**
  - * Destroy the socket.
  - * br /
  - * This function destroys the pool used for codeattach/code call.
  - * The main usage for this function is to allow the SSLSocket to be
  - * passed as client data to the Poll.
  - * @param thesocket The socket to destroy
  - */
  -public static native int destroy(long thesocket);
  -
  -/**
  - * Send data over a network.
  - * PRE
  - * This functions acts like a blocking write by default.  To change
  - * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
  - * socket option

cvs commit: jakarta-tomcat-connectors/jni/native/src network.c sslnetwork.c

2005-06-17 Thread mturk
mturk   2005/06/17 07:17:00

  Modified:jni/native/include tcn.h
   jni/native/src network.c sslnetwork.c
  Log:
  Instead duplicating entire Socket API, duplicate APR API.
  
  Revision  ChangesPath
  1.21  +12 -16jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- tcn.h 17 Jun 2005 11:22:30 -  1.20
  +++ tcn.h 17 Jun 2005 14:17:00 -  1.21
  @@ -45,7 +45,7 @@
   #include process.h
   #else
   #include unistd.h
  -#endif 
  +#endif
   #include jni.h
   
   #if defined(_DEBUG) || defined(DEBUG)
  @@ -107,26 +107,22 @@
   
   #define TCN_GETNET_METHOD(FN)  method_##FN
   
  -#define TCN_SOCKET_APR  1
  -#define TCN_SOCKET_SSL  2
  -#define TCN_SOCKET_UNIX 4
  -#define TCN_SOCKET_NTPIPE   5
  +#define TCN_SOCKET_APR  0
  +#define TCN_SOCKET_SSL  1
  +#define TCN_SOCKET_UNIX 2
  +#define TCN_SOCKET_NTPIPE   3
   
   typedef struct {
   apr_pool_t   *pool;
   apr_socket_t *sock;
   void *opaque;
   int  type;
  -apr_status_t (*cleanup)(void *opaque);
  -jint (*shutdown)(TCN_IMPARGS, jint how);
  -jint (*close)(TCN_IMPARGS);
  -jint (*send)(TCN_IMPARGS, jbyteArray buf, jint offset, jint tosend);
  -jint (*sendb)(TCN_IMPARGS, jobject buf, jint offset, jint len);
  -jint (*sendv)(TCN_IMPARGS, jobjectArray bufs);
  -jint (*recv)(TCN_IMPARGS, jbyteArray buf, jint offset, jint toread);
  -jint (*recvt)(TCN_IMPARGS, jbyteArray buf, jint offset, jint toread, 
jlong timeout);
  -jint (*recvb)(TCN_IMPARGS, jobject buf, jint offset, jint len);
  -jint (*recvbt)(TCN_IMPARGS, jobject buf, jint offset, jint len, jlong 
timeout);
  +apr_status_t (*cleanup)(void *);
  +apr_status_t (APR_THREAD_FUNC *net_send) (void *, const char *, 
apr_size_t *);
  +apr_status_t (APR_THREAD_FUNC *net_sendv)(void *sock, const struct iovec 
*, apr_int32_t, apr_size_t *);
  +apr_status_t (APR_THREAD_FUNC *net_recv) (void *sock, char *, apr_size_t 
*);
  +apr_status_t (APR_THREAD_FUNC *net_close) (void *);
  +apr_status_t (APR_THREAD_FUNC *net_shutdown) (void *, 
apr_shutdown_how_e);
   
   } tcn_socket_t;
   
  
  
  
  1.29  +27 -34jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- network.c 17 Jun 2005 11:22:30 -  1.28
  +++ network.c 17 Jun 2005 14:17:00 -  1.29
  @@ -189,6 +189,12 @@
   a-sock = s;
   a-pool = p;
   a-type = TCN_SOCKET_APR;
  +a-net_recv = apr_socket_recv;
  +a-net_send = apr_socket_send;
  +a-net_sendv= apr_socket_sendv;
  +a-net_shutdown = apr_socket_shutdown;
  +a-net_close= NULL;
  +a-opaque   = s;
   apr_pool_cleanup_register(p, (const void *)a,
 sp_socket_cleanup,
 apr_pool_cleanup_null);
  @@ -223,10 +229,7 @@
   
   UNREFERENCED_STDARGS;
   TCN_ASSERT(sock != 0);
  -if (s-shutdown)
  -return (*s-shutdown)(TCN_IMPCALL(s), how);
  -else
  -return (jint)apr_socket_shutdown(s-sock, (apr_shutdown_how_e)how);
  +return (jint)(*s-net_shutdown)(s-opaque, how);
   }
   
   TCN_IMPLEMENT_CALL(jint, Socket, close)(TCN_STDARGS, jlong sock)
  @@ -239,9 +242,9 @@
   #ifdef TCN_DO_STATISTICS
   apr_atomic_inc32(sp_closed);
   #endif
  -if (s-close)
  -rv = (*s-close)(TCN_IMPCALL(s));
  -if (s-sock) {
  +if (s-net_close)
  +rv = (*s-net_close)(s-opaque);
  +if (s-sock) {
   rv = (jint)apr_socket_close(s-sock);
   s-sock = NULL;
   }
  @@ -290,6 +293,12 @@
   a-sock = n;
   a-pool = p;
   a-type = TCN_SOCKET_APR;
  +a-net_recv = apr_socket_recv;
  +a-net_send = apr_socket_send;
  +a-net_sendv= apr_socket_sendv;
  +a-net_shutdown = apr_socket_shutdown;
  +a-net_close= NULL;
  +a-opaque   = n;
   apr_pool_cleanup_register(p, (const void *)a,
 sp_socket_cleanup,
 apr_pool_cleanup_null);
  @@ -320,8 +329,6 @@
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
   
  -if (s-send)
  -return (*s-send)(TCN_IMPCALL(s), buf, offset, tosend);
   if (tosend = TCN_BUFFER_SZ) {
   char sb[TCN_BUFFER_SZ];
   (*e)-GetByteArrayRegion(e, buf, offset, tosend, (jbyte *)sb);
  @@ -335,8 +342,7 @@
   bytes = (*e

cvs commit: jakarta-tomcat-connectors/jk/native/apache-2.0 mod_jk.c

2005-06-16 Thread mturk
mturk   2005/06/15 23:30:45

  Modified:jk/native/apache-2.0 mod_jk.c
  Log:
  Remove the second invocation for 'ap_get_module_config'.
  Have no idea why it was called twice, because it can not change during
  the request. Also remove the useless r-uri duplication.
  
  Revision  ChangesPath
  1.151 +11 -32jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
  
  Index: mod_jk.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
  retrieving revision 1.150
  retrieving revision 1.151
  diff -u -r1.150 -r1.151
  --- mod_jk.c  19 May 2005 06:31:42 -  1.150
  +++ mod_jk.c  16 Jun 2005 06:30:45 -  1.151
  @@ -1755,7 +1755,6 @@
   {
   const char *worker_name;
   jk_server_conf_t *xconf;
  -jk_server_conf_t *conf;
   int rc, dmt = 1;
   
   /* We do DIR_MAGIC_TYPE here to make sure TC gets all requests, even
  @@ -1767,9 +1766,8 @@
(dmt = strcmp(r-handler, DIR_MAGIC_TYPE)))
   return DECLINED;
   
  -xconf =
  -(jk_server_conf_t *) ap_get_module_config(r-server-module_config,
  -  jk_module);
  +xconf = (jk_server_conf_t *) 
ap_get_module_config(r-server-module_config,
  +  jk_module);
   JK_TRACE_ENTER(xconf-log);
   if (apr_table_get(r-subprocess_env, no-jk)) {
   jk_log(xconf-log, JK_LOG_DEBUG,
  @@ -1819,6 +1817,8 @@
  worker_name, worker_env.num_of_workers, r-uri);
   }
   }
  +if (worker_name)
  +apr_table_setn(r-notes, JK_WORKER_ID, worker_name);
   }
   
   if (JK_IS_DEBUG_LEVEL(xconf-log))
  @@ -1826,9 +1826,6 @@
  r-proxyreq=%d,
 r-handler, worker_name, r-proxyreq);
   
  -conf = (jk_server_conf_t *) 
ap_get_module_config(r-server-module_config,
  - jk_module);
  -
   /* If this is a proxy request, we'll notify an error */
   if (r-proxyreq) {
   jk_log(xconf-log, JK_LOG_INFO, Proxy request for worker=%s
  @@ -1838,20 +1835,6 @@
   return HTTP_INTERNAL_SERVER_ERROR;
   }
   
  -if (conf  !worker_name) {
  -/* Direct mapping ( via setHandler ). Try overrides */
  -char *uri = apr_pstrdup(r-pool, r-uri);
  -worker_name = map_uri_to_worker(conf-uw_map, uri, conf-log);
  -if (!worker_name) {
  -/* Since we are here, an explicit (native) mapping has been used 
*/
  -/* Use default worker */
  -worker_name = ajp14;  /* XXX add a directive for default */
  -}
  -if (worker_name) {
  -apr_table_setn(r-notes, JK_WORKER_ID, worker_name);
  -}
  -}
  -
   if (worker_name) {
   jk_worker_t *worker = wc_get_worker_for_name(worker_name, 
xconf-log);
   
  @@ -1887,12 +1870,12 @@
   s.ws_private = private_data;
   s.pool = private_data.p;
   #ifndef NO_GETTIMEOFDAY
  -if (conf-format != NULL) {
  +if (xconf-format != NULL) {
   gettimeofday(tv_begin, NULL);
   }
   #endif
   
  -if (init_ws_service(private_data, s, conf)) {
  +if (init_ws_service(private_data, s, xconf)) {
   jk_endpoint_t *end = NULL;
   
   /* Use per/thread pool ( or context ) to reuse the
  @@ -1940,7 +1923,7 @@
   return HTTP_INTERNAL_SERVER_ERROR;
   }
   #ifndef NO_GETTIMEOFDAY
  -if (conf-format != NULL) {
  +if (xconf-format != NULL) {
   char *duration = NULL;
   long micro, seconds;
   gettimeofday(tv_end, NULL);
  @@ -1952,7 +1935,7 @@
   seconds = tv_end.tv_sec - tv_begin.tv_sec;
   duration = apr_psprintf(r-pool, %.1ld.%.6ld, seconds, 
micro);
   apr_table_setn(r-notes, JK_DURATION, duration);
  -request_log_transaction(r, conf);
  +request_log_transaction(r, xconf);
   }
   #endif
   
  @@ -2485,7 +2468,6 @@
   
   if (conf) {
   const char *worker;
  -char *uri;
   if ((r-handler != NULL)  (!strcmp(r-handler, JK_HANDLER))) {
   /* Somebody already set the handler, probably manual config
* or native configuration, no need for extra overhead
  @@ -2541,8 +2523,7 @@
   }
   }
   
  -uri = apr_pstrdup(r-pool, r-uri);
  -worker = map_uri_to_worker(conf-uw_map, uri, conf-log);
  +worker = map_uri_to_worker(conf-uw_map, r-uri, conf-log);
   
   if (worker) {
   r-handler = apr_pstrdup(r-pool, JK_HANDLER);
  @@ -2666,7 +2647,6

cvs commit: jakarta-tomcat-connectors/procrun/bin tomcat5.exe tomcat5w.exe

2005-06-16 Thread mturk
mturk   2005/06/16 03:05:49

  Modified:procrun/bin Tag: TOMCAT_5_0 tomcat5.exe tomcat5w.exe
  Log:
  Add 'Thread Dump' signal for service mode.
  Manager has a menu item 'Thread Dump' that sends the CTRL+BREAK
  evant to the service.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.2.2.8   +118 -119  jakarta-tomcat-connectors/procrun/bin/tomcat5.exe
  
Binary file
  
  
  1.2.2.9   +242 -242  jakarta-tomcat-connectors/procrun/bin/tomcat5w.exe
  
Binary file
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src jnilib.c ssl.c sslinfo.c

2005-06-16 Thread mturk
mturk   2005/06/16 04:39:12

  Modified:jni/native/include ssl_private.h tcn.h
   jni/native/src jnilib.c ssl.c sslinfo.c
  Log:
  Add more SSL infos.
  Also change the tcn_new_string to allow the NULL to be passed.
  
  Revision  ChangesPath
  1.30  +4 -1  
jakarta-tomcat-connectors/jni/native/include/ssl_private.h
  
  Index: ssl_private.h
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/native/include/ssl_private.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ssl_private.h 15 Jun 2005 12:08:02 -  1.29
  +++ ssl_private.h 16 Jun 2005 11:39:12 -  1.30
  @@ -145,6 +145,9 @@
   #define SSL_INFO_CIPHER (2)
   #define SSL_INFO_CIPHER_USEKEYSIZE  (3)
   #define SSL_INFO_CIPHER_ALGKEYSIZE  (4)
  +#define SSL_INFO_CIPHER_VERSION (5)
  +#define SSL_INFO_CIPHER_DESCRIPTION (6)
  +#define SSL_INFO_PROTOCOL   (7)
   
   #define SSL_VERIFY_ERROR_IS_OPTIONAL(errnum) \
  ((errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) \
  
  
  
  1.18  +4 -2  jakarta-tomcat-connectors/jni/native/include/tcn.h
  
  Index: tcn.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/include/tcn.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- tcn.h 12 Jun 2005 07:01:03 -  1.17
  +++ tcn.h 16 Jun 2005 11:39:12 -  1.18
  @@ -97,7 +97,9 @@
   voidtcn_Throw(JNIEnv *, const char *, ...);
   voidtcn_ThrowException(JNIEnv *, const char *);
   voidtcn_ThrowAPRException(JNIEnv *, apr_status_t);
  -jstring tcn_new_string(JNIEnv *, const char *, int);
  +jstring tcn_new_string(JNIEnv *, const char *);
  +jstring tcn_new_stringn(JNIEnv *, const char *, size_t);
  +jbyteArray  tcn_new_arrayb(JNIEnv *, const unsigned char *, size_t);
   char   *tcn_get_string(JNIEnv *, jstring);
   char   *tcn_strdup(JNIEnv *, jstring);
   char   *tcn_pstrdup(JNIEnv *, jstring, apr_pool_t *);
  
  
  
  1.10  +23 -3 jakarta-tomcat-connectors/jni/native/src/jnilib.c
  
  Index: jnilib.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/jnilib.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- jnilib.c  10 Jun 2005 10:30:18 -  1.9
  +++ jnilib.c  16 Jun 2005 11:39:12 -  1.10
  @@ -89,12 +89,14 @@
   apr_terminate();
   }
   
  -jstring tcn_new_string(JNIEnv *env, const char *str, int l)
  +jstring tcn_new_stringn(JNIEnv *env, const char *str, size_t l)
   {
   jstring result;
   jbyteArray bytes = 0;
   size_t len = l;
  -
  +
  +if (!str)
  +return NULL;
   if ((*env)-EnsureLocalCapacity(env, 2)  0) {
   return NULL; /* out of memory error */
   }
  @@ -110,6 +112,24 @@
   return NULL;
   }
   
  +jbyteArray tcn_new_arrayb(JNIEnv *env, const unsigned char *data, size_t len)
  +{
  +jbyteArray bytes = (*env)-NewByteArray(env, (jsize)len);
  +if (bytes != NULL) {
  +(*env)-SetByteArrayRegion(env, bytes, 0, (jint)len, (jbyte *)data);
  +}
  +return bytes;
  +}
  +
  +
  +jstring tcn_new_string(JNIEnv *env, const char *str)
  +{
  +if (!str)
  +return NULL;
  +else
  +return (*env)-NewStringUTF(env, str);
  +}
  +
   char *tcn_get_string(JNIEnv *env, jstring jstr)
   {
   jbyteArray bytes = NULL;
  
  
  
  1.36  +3 -3  jakarta-tomcat-connectors/jni/native/src/ssl.c
  
  Index: ssl.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/ssl.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- ssl.c 12 Jun 2005 07:33:08 -  1.35
  +++ ssl.c 16 Jun 2005 11:39:12 -  1.36
  @@ -599,7 +599,7 @@
   JNIEnv   *e = j-cb.env;
   ret = (*e)-CallIntMethod(e, j-cb.obj,
 j-cb.mid[2],
  -  tcn_new_string(e, in, -1));
  +  tcn_new_string(e, in));
   }
   return ret;
   }
  @@ -775,7 +775,7 @@
   char buf[256];
   UNREFERENCED(o);
   ERR_error_string(ERR_get_error(), buf);
  -return tcn_new_string(e, buf, -1);
  +return tcn_new_string(e, buf);
   }
   
   #else
  
  
  
  1.3   +23 -6 jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- sslinfo.c 15 Jun 2005 12:08:02 -  1.2

cvs commit: jakarta-tomcat-connectors/procrun/bin tomcat5.exe tomcat5w.exe

2005-06-16 Thread mturk
mturk   2005/06/16 03:05:03

  Modified:procrun/bin tomcat5.exe tomcat5w.exe
  Log:
  Add 'Thread Dump' signal for service mode.
  Manager has a menu item 'Thread Dump' that sends the CTRL+BREAK
  evant to the service.
  
  Revision  ChangesPath
  1.14  +118 -119  jakarta-tomcat-connectors/procrun/bin/tomcat5.exe
  
Binary file
  
  
  1.13  +242 -242  jakarta-tomcat-connectors/procrun/bin/tomcat5w.exe
  
Binary file
  
  

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



cvs commit: jakarta-tomcat-connectors/procrun/bin tomcat5.exe tomcat5w.exe

2005-06-16 Thread mturk
mturk   2005/06/16 09:58:33

  Modified:procrun/bin tomcat5.exe tomcat5w.exe
  Log:
  Fix bug 35359 --
  Crash with Environment variables that do not contain %.
  
  Revision  ChangesPath
  1.15  +49 -48jakarta-tomcat-connectors/procrun/bin/tomcat5.exe
  
Binary file
  
  
  1.14  +3 -3  jakarta-tomcat-connectors/procrun/bin/tomcat5w.exe
  
Binary file
  
  

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



cvs commit: jakarta-tomcat-connectors/procrun/bin tomcat5.exe tomcat5w.exe

2005-06-16 Thread mturk
mturk   2005/06/16 09:59:25

  Modified:procrun/bin Tag: TOMCAT_5_0 tomcat5.exe tomcat5w.exe
  Log:
  Fix bug 35359 --
  Crash with Environment variables that do not contain %.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.2.2.9   +49 -48jakarta-tomcat-connectors/procrun/bin/tomcat5.exe
  
Binary file
  
  
  1.2.2.10  +3 -3  jakarta-tomcat-connectors/procrun/bin/tomcat5w.exe
  
Binary file
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src sslinfo.c

2005-06-15 Thread mturk
mturk   2005/06/15 05:08:02

  Modified:jni/java/org/apache/tomcat/jni SSL.java SSLSocket.java
   jni/native/include ssl_private.h
   jni/native/src sslinfo.c
  Log:
  Update sslinfo to use the indexed approach to the params instead
  a name based. This way we'll keep the lower number of native functions.
  
  Revision  ChangesPath
  1.19  +7 -2  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSL.java
  
  Index: SSL.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSL.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SSL.java  12 Jun 2005 07:33:08 -  1.18
  +++ SSL.java  15 Jun 2005 12:08:02 -  1.19
  @@ -158,6 +158,11 @@
   public static final int SSL_SHUTDOWN_TYPE_UNCLEAN  = 2;
   public static final int SSL_SHUTDOWN_TYPE_ACCURATE = 3;
   
  +public static final int SSL_INFO_SESSION_ID = 1;
  +public static final int SSL_INFO_CIPHER = 2;
  +public static final int SSL_INFO_CIPHER_USEKEYSIZE  = 3;
  +public static final int SSL_INFO_CIPHER_ALGKEYSIZE  = 4;
  +
   /* Return OpenSSL version number */
   public static native int version();
   
  @@ -261,7 +266,7 @@
* @param file File contatining DH params.
*/
   public static native boolean loadDSATempKey(int idx, String file);
  -
  +
   /**
* Return last SSL error string
*/
  
  
  
  1.12  +27 -4 
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java
  
  Index: SSLSocket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SSLSocket.java14 Jun 2005 20:59:33 -  1.11
  +++ SSLSocket.java15 Jun 2005 12:08:02 -  1.12
  @@ -234,10 +234,33 @@
   int offset, int nbytes, long timeout);
   
   /**
  - * Retrun SSL SESSION id.
  + * Retrun SSL Info parameter as byte array.
*
* @param sock The socket to read the data from.
  - * @return Byte array containing session id.
  + * @param id Parameter id.
  + * @return Byte array containing info id value.
*/
  -public static native byte[] getSessionId(long sock);
  +public static native byte[] getInfoB(long sock, int id)
  +throws Exception;
  +
  +/**
  + * Retrun SSL Info parameter as String.
  + *
  + * @param sock The socket to read the data from.
  + * @param id Parameter id.
  + * @return String containing info id value.
  + */
  +public static native String getInfoS(long sock, int id)
  +throws Exception;
  +
  +/**
  + * Retrun SSL Info parameter as integer.
  + *
  + * @param sock The socket to read the data from.
  + * @param id Parameter id.
  + * @return Integer containing info id value or -1 on error.
  + */
  +public static native int getInfoI(long sock, int id)
  +throws Exception;
  +
   }
  
  
  
  1.29  +6 -1  
jakarta-tomcat-connectors/jni/native/include/ssl_private.h
  
  Index: ssl_private.h
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/native/include/ssl_private.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ssl_private.h 12 Jun 2005 10:31:16 -  1.28
  +++ ssl_private.h 15 Jun 2005 12:08:02 -  1.29
  @@ -141,6 +141,11 @@
   
   #define SSL_TO_APR_ERROR(X) (APR_OS_START_USERERR + 1000 + X)
   
  +#define SSL_INFO_SESSION_ID (1)
  +#define SSL_INFO_CIPHER (2)
  +#define SSL_INFO_CIPHER_USEKEYSIZE  (3)
  +#define SSL_INFO_CIPHER_ALGKEYSIZE  (4)
  +
   #define SSL_VERIFY_ERROR_IS_OPTIONAL(errnum) \
  ((errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) \
   || (errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) \
  
  
  
  1.2   +103 -13   jakarta-tomcat-connectors/jni/native/src/sslinfo.c
  
  Index: sslinfo.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslinfo.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sslinfo.c 14 Jun 2005 11:55:54 -  1.1
  +++ sslinfo.c 15 Jun 2005 12:08:02 -  1.2
  @@ -31,27 +31,117 @@
   #ifdef HAVE_OPENSSL
   #include ssl_private.h
   
  -TCN_IMPLEMENT_CALL(jobject, SSLSocket, getSessionId)(TCN_STDARGS, jlong sock)
  +static const char *hex_basis = 0123456789ABCDEF;
  +
  +static char *convert_to_hex(const void *buf, size_t len)
  +{
  +const unsigned char *p = ( const unsigned char *)buf

cvs commit: jakarta-tomcat-connectors/jni/native/src network.c

2005-06-15 Thread mturk
mturk   2005/06/15 07:43:13

  Modified:jni/native/src network.c
  Log:
  Use stack buffer for small ( 8K) byte arrays.
  
  Revision  ChangesPath
  1.26  +43 -26jakarta-tomcat-connectors/jni/native/src/network.c
  
  Index: network.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/network.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- network.c 10 Jun 2005 07:06:10 -  1.25
  +++ network.c 15 Jun 2005 14:43:12 -  1.26
  @@ -27,7 +27,6 @@
   
   #ifdef TCN_DO_STATISTICS
   #include apr_atomic.h
  -
   static volatile apr_uint32_t sp_created  = 0;
   static volatile apr_uint32_t sp_closed   = 0;
   static volatile apr_uint32_t sp_cleared  = 0;
  @@ -272,23 +271,30 @@
   {
   apr_socket_t *s = J2P(sock, apr_socket_t *);
   apr_size_t nbytes = (apr_size_t)tosend;
  -jbyte *bytes;
  -apr_int32_t nb;
   apr_status_t ss;
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  -apr_socket_opt_get(s, APR_SO_NONBLOCK, nb);
  -if (nb)
  - bytes = (*e)-GetPrimitiveArrayCritical(e, buf, NULL);
  -else
  - bytes = (*e)-GetByteArrayElements(e, buf, NULL);
  -ss = apr_socket_send(s, bytes + offset, nbytes);
  -
  -if (nb)
  -(*e)-ReleasePrimitiveArrayCritical(e, buf, bytes, JNI_ABORT);
  -else
  -(*e)-ReleaseByteArrayElements(e, buf, bytes, JNI_ABORT);
  +if (tosend = TCN_BUFFER_SZ) {
  +char sb[TCN_BUFFER_SZ];
  +(*e)-GetByteArrayRegion(e, buf, offset, tosend, (jbyte *)sb);
  +ss = apr_socket_send(s, sb, nbytes);
  +}
  +else {
  +jbyte *bytes;
  +apr_int32_t nb;
  +apr_socket_opt_get(s, APR_SO_NONBLOCK, nb);
  +if (nb)
  +bytes = (*e)-GetPrimitiveArrayCritical(e, buf, NULL);
  +else
  +bytes = (*e)-GetByteArrayElements(e, buf, NULL);
  +ss = apr_socket_send(s, bytes + offset, nbytes);
  +
  +if (nb)
  +(*e)-ReleasePrimitiveArrayCritical(e, buf, bytes, JNI_ABORT);
  +else
  +(*e)-ReleaseByteArrayElements(e, buf, bytes, JNI_ABORT);
  +}
   if (ss == APR_SUCCESS)
   return (jint)nbytes;
   else {
  @@ -393,16 +399,21 @@
   {
   apr_socket_t *s = J2P(sock, apr_socket_t *);
   apr_size_t nbytes = (apr_size_t)toread;
  -jbyte *bytes = (*e)-GetByteArrayElements(e, buf, NULL);
   apr_status_t ss;
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
  -TCN_ASSERT(bytes != NULL);
  -ss = apr_socket_recv(s, bytes + offset, nbytes);
  -
  -(*e)-ReleaseByteArrayElements(e, buf, bytes,
  -   nbytes ? 0 : JNI_ABORT);
  +if (toread = TCN_BUFFER_SZ) {
  +char sb[TCN_BUFFER_SZ];
  +if ((ss = apr_socket_recv(s, sb, nbytes)) == APR_SUCCESS)
  +(*e)-SetByteArrayRegion(e, buf, offset, (jsize)nbytes, sb);
  +}
  +else {
  +jbyte *bytes = (*e)-GetByteArrayElements(e, buf, NULL);
  +ss = apr_socket_recv(s, bytes + offset, nbytes);
  +(*e)-ReleaseByteArrayElements(e, buf, bytes,
  +   nbytes ? 0 : JNI_ABORT);
  +}
   if (ss == APR_SUCCESS)
   return (jint)nbytes;
   else {
  @@ -417,25 +428,31 @@
   {
   apr_socket_t *s = J2P(sock, apr_socket_t *);
   apr_size_t nbytes = (apr_size_t)toread;
  -jbyte *bytes = (*e)-GetByteArrayElements(e, buf, NULL);
   apr_status_t ss;
   apr_interval_time_t t;
   
   UNREFERENCED(o);
   TCN_ASSERT(sock != 0);
   TCN_ASSERT(buf != NULL);
  -TCN_ASSERT(bytes != NULL);
   
   if ((ss = apr_socket_timeout_get(s, t)) != APR_SUCCESS)
   goto cleanup;
   if ((ss = apr_socket_timeout_set(s, J2T(timeout))) != APR_SUCCESS)
   goto cleanup;
  -ss = apr_socket_recv(s, bytes + offset, nbytes);
  +if (toread = TCN_BUFFER_SZ) {
  +char sb[TCN_BUFFER_SZ];
  +ss = apr_socket_recv(s, sb, nbytes);
  +(*e)-SetByteArrayRegion(e, buf, offset, (jsize)nbytes, sb);
  +}
  +else {
  +jbyte *bytes = (*e)-GetByteArrayElements(e, buf, NULL);
  +ss = apr_socket_recv(s, bytes + offset, nbytes);
  +(*e)-ReleaseByteArrayElements(e, buf, bytes,
  +   nbytes ? 0 : JNI_ABORT);
  +}
   /* Resore the original timeout */
   apr_socket_timeout_set(s, t);
   cleanup:
  -(*e)-ReleaseByteArrayElements(e, buf, bytes,
  -   nbytes ? 0 : JNI_ABORT);
   if (ss == APR_SUCCESS)
   return (jint)nbytes;
   else {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_global.h jk_lb_worker.c jk_shm.h jk_status.c

2005-06-14 Thread mturk
mturk   2005/06/13 23:34:13

  Modified:jk/native/common jk_global.h jk_lb_worker.c jk_shm.h
jk_status.c
  Log:
  Use 64 bit unsigned ints instead doubles for transferred/read.
  
  Revision  ChangesPath
  1.50  +4 -1  jakarta-tomcat-connectors/jk/native/common/jk_global.h
  
  Index: jk_global.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_global.h,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- jk_global.h   18 May 2005 18:04:53 -  1.49
  +++ jk_global.h   14 Jun 2005 06:34:13 -  1.50
  @@ -253,6 +253,9 @@
   #define snprintf _snprintf
   #define vsnprintf _vsnprintf
   #endif
  +typedef unsigned __int64 jk_u64_t;
  +#else
  +typedef unsigned long long jk_u64_t;
   #endif
   
   /* Use apr snprintf() and vsnprintf() when needed */
  
  
  
  1.91  +5 -5  jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_lb_worker.c,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- jk_lb_worker.c13 Jun 2005 07:55:51 -  1.90
  +++ jk_lb_worker.c14 Jun 2005 06:34:13 -  1.91
  @@ -225,8 +225,8 @@
   {
   unsigned int i;
   int total_factor = 0;
  -double mytraffic = 0;
  -double curmin = 0;
  +jk_u64_t mytraffic = 0;
  +jk_u64_t curmin = 0;
   
   worker_record_t *candidate = NULL;
   if (p-lblock == JK_LB_LOCK_PESSIMISTIC)
  @@ -313,8 +313,8 @@
jk_logger_t *l)
   {
   unsigned int i;
  -double mytraffic = 0;
  -double curmin = 0;
  +jk_u64_t mytraffic = 0;
  +jk_u64_t curmin = 0;
   worker_record_t *candidate = NULL;
   
   if (p-lblock == JK_LB_LOCK_PESSIMISTIC)
  
  
  
  1.22  +3 -3  jakarta-tomcat-connectors/jk/native/common/jk_shm.h
  
  Index: jk_shm.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_shm.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- jk_shm.h  13 Jun 2005 07:55:51 -  1.21
  +++ jk_shm.h  14 Jun 2005 06:34:13 -  1.22
  @@ -81,9 +81,9 @@
   /* Statistical data */
   volatile time_t  error_time;
   /* Number of bytes read from remote */
  -volatile double  readed;
  +volatile jk_u64_t readed;
   /* Number of bytes transferred to remote */
  -volatile double  transferred;
  +volatile jk_u64_t transferred;
   /* Number of times the worker was elected */
   volatile size_t  elected;
   /* Number of non 200 responses */
  
  
  
  1.43  +16 -4 jakarta-tomcat-connectors/jk/native/common/jk_status.c
  
  Index: jk_status.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_status.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- jk_status.c   13 Jun 2005 07:55:51 -  1.42
  +++ jk_status.c   14 Jun 2005 06:34:13 -  1.43
  @@ -166,10 +166,11 @@
   }
   
   /* Actually APR's apr_strfsize */
  -static char *status_strfsize(double size, char *buf)
  +static char *status_strfsize(jk_u64_t size, char *buf)
   {
   const char ord[] = KMGTPE;
   const char *o = ord;
  +unsigned int remain, siz;
   
   if (size  0) {
   return strcpy(buf,   - );
  @@ -180,12 +181,23 @@
   return buf;
   }
   do {
  -size /= 1024;
  +remain = (unsigned int)(size  0x03FF);
  +size = 10;
   if (size = 973) {
   ++o;
   continue;
   }
  -if (sprintf(buf, %.2f%c, size, *o)  0)
  +siz = (unsigned int)(size  0x);
  +if (siz  9 || (siz == 9  remain  973)) {
  +if ((remain = ((remain * 5) + 256) / 512) = 10)
  +++siz, remain = 0;
  +if (sprintf(buf, %d.%d%c, siz, remain, *o)  0)
  +return strcpy(buf, );
  +return buf;
  +}
  +if (remain = 512)
  +++siz;
  +if (sprintf(buf, %3d%c, siz, *o)  0)
   return strcpy(buf, );
   return buf;
   } while (1);
  
  
  

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



cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net AprEndpoint.java

2005-06-14 Thread mturk
mturk   2005/06/13 23:55:20

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Use the same locking object for add and maintain.
  Also make sure that sockets in the add queue are
  closed on destroy.
  
  Revision  ChangesPath
  1.42  +5 -1  
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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- AprEndpoint.java  10 Jun 2005 14:36:18 -  1.41
  +++ AprEndpoint.java  14 Jun 2005 06:55:20 -  1.42
  @@ -796,6 +796,10 @@
* Destroy the poller.
*/
   protected void destroy() {
  +/* Remove the sockets in the add queue */
  +for (int i = 0; i  addCount; i--) {
  +Pool.destroy(addP[i]);
  +}
   Pool.destroy(pool);
   }
   
  @@ -899,7 +903,7 @@
   }
   }
   if (rv == 0 || maintainTime  100L) {
  -synchronized (this) {
  +synchronized (addS) {
   rv = Poll.maintain(serverPollset, desc, true);
   maintainTime = 0;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src poll.c

2005-06-14 Thread mturk
mturk   2005/06/14 00:14:00

  Modified:jni/java/org/apache/tomcat/jni Poll.java
   jni/native/src poll.c
  Log:
  Add Poll.pollset method to return all the descriptors that are
  currently in the Poll.
  
  Revision  ChangesPath
  1.9   +19 -1 
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Poll.java
  
  Index: Poll.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/Poll.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Poll.java 19 Apr 2005 16:32:11 -  1.8
  +++ Poll.java 14 Jun 2005 07:14:00 -  1.9
  @@ -144,4 +144,22 @@
*/
   public static native long getTtl(long pollset);
   
  +/**
  + * Return all descriptor(s) in a pollset
  + * @param pollset The pollset to use
  + * @param descriptors Array of descriptors (output parameter)
  + *The desctiptor array must be four times the size of pollset.
  + *and are populated as follows:
  + * PRE
  + * descriptors[n + 0] - returned events
  + * descriptors[n + 1] - socket
  + * descriptors[n + 2] - client data
  + * descriptors[n + 2] - reserved
  + * /PRE
  + * @return Number of descriptors (output parameter) in the Poll
  + * or negative APR error code.
  + */
  +public static native int pollset(long pollset, long [] descriptors,
  + boolean remove);
  +
   }
  
  
  
  1.19  +26 -1 jakarta-tomcat-connectors/jni/native/src/poll.c
  
  Index: poll.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/poll.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- poll.c10 Jun 2005 07:06:10 -  1.18
  +++ poll.c14 Jun 2005 07:14:00 -  1.19
  @@ -340,3 +340,28 @@
   UNREFERENCED_STDARGS;
   return (jlong)p-max_ttl;
   }
  +
  +TCN_IMPLEMENT_CALL(jint, Poll, pollset)(TCN_STDARGS, jlong pollset,
  +jlongArray set)
  +{
  +tcn_pollset_t *p = J2P(pollset,  tcn_pollset_t *);
  +jlong *pset = (*e)-GetLongArrayElements(e, set, NULL);
  +apr_int32_t  i = 0;
  +apr_pollfd_t fd;
  +
  +UNREFERENCED(o);
  +TCN_ASSERT(pollset != 0);
  +
  +for (i = 0; i  p-nelts; i++) {
  +p-socket_set[i].rtnevents = APR_POLLHUP | APR_POLLIN;
  +fd = p-socket_set[i];
  +pset[i*4+0] = (jlong)(fd.rtnevents);
  +pset[i*4+1] = P2J(fd.desc.s);
  +pset[i*4+2] = P2J(fd.client_data);
  +}
  +if (p-nelts)
  +(*e)-ReleaseLongArrayElements(e, set, pset, 0);
  +else
  +(*e)-ReleaseLongArrayElements(e, set, pset, JNI_ABORT);
  +return (jint)p-nelts;
  +}
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jni/native/src poll.c

2005-06-14 Thread mturk
mturk   2005/06/14 00:34:46

  Modified:jni/native/src poll.c
  Log:
  Skip useless array length compare.
  
  Revision  ChangesPath
  1.20  +6 -8  jakarta-tomcat-connectors/jni/native/src/poll.c
  
  Index: poll.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/poll.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- poll.c14 Jun 2005 07:14:00 -  1.19
  +++ poll.c14 Jun 2005 07:34:46 -  1.20
  @@ -297,13 +297,11 @@
   for (i = 0; i  p-nelts; i++) {
   if ((now - p-socket_ttl[i])  p-max_ttl) {
   p-socket_set[i].rtnevents = APR_POLLHUP | APR_POLLIN;
  -if (num  p-nelts) {
  -fd = p-socket_set[i];
  -pset[num*4+0] = (jlong)(fd.rtnevents);
  -pset[num*4+1] = P2J(fd.desc.s);
  -pset[num*4+2] = P2J(fd.client_data);
  -num++;
  -}
  +fd = p-socket_set[i];
  +pset[num*4+0] = (jlong)(fd.rtnevents);
  +pset[num*4+1] = P2J(fd.desc.s);
  +pset[num*4+2] = P2J(fd.client_data);
  +num++;
   }
   }
   if (remove  num) {
  
  
  

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



cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net AprEndpoint.java

2005-06-14 Thread mturk
mturk   2005/06/14 01:23:25

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Change the way how maintain is called. There is no need to
  call the maintain on each TIMEUP.
  
  Revision  ChangesPath
  1.44  +9 -10 
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.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- AprEndpoint.java  14 Jun 2005 07:43:29 -  1.43
  +++ AprEndpoint.java  14 Jun 2005 08:23:25 -  1.44
  @@ -834,12 +834,13 @@
*/
   public void run() {
   
  +long maintainTime = 0;
   // Loop until we receive a shutdown command
   while (running) {
  -long maintainTime = 0;
   // Loop if endpoint is paused
   while (paused) {
   try {
  +// TODO: We can easly do the maintenance here
   Thread.sleep(1000);
   } catch (InterruptedException e) {
   // Ignore
  @@ -847,6 +848,8 @@
   }
   
   while (keepAliveCount  1  addCount  1) {
  +// Reset maintain time.
  +maintainTime = 0;
   try {
   synchronized (addS) {
   addS.wait();
  @@ -873,6 +876,7 @@
   addCount = 0;
   }
   }
  +maintainTime += pollTime;
   // Pool for the specified interval
   int rv = Poll.poll(serverPollset, pollTime, desc, true);
   if (rv  0) {
  @@ -888,12 +892,9 @@
   // Hand this socket off to a worker
   getWorkerThread().assign(desc[n*4+1], 
desc[n*4+2]);
   }
  -maintainTime += pollTime;
   } else if (rv  0) {
   /* Any non timeup error is critical */
  -if (-rv == Status.TIMEUP)
  -rv = 0;
  -else {
  +if (-rv != Status.TIMEUP) {
   log.error(sm.getString(endpoint.poll.fail));
   // Handle poll critical failure
   synchronized (this) {
  @@ -902,11 +903,9 @@
   }
   }
   }
  -if (rv == 0 || maintainTime  100L) {
  -synchronized (addS) {
  -rv = Poll.maintain(serverPollset, desc, true);
  -maintainTime = 0;
  -}
  +if (maintainTime  100L) {
  +rv = Poll.maintain(serverPollset, desc, true);
  +maintainTime = 0;
   if (rv  0) {
   keepAliveCount -= rv;
   for (int n = 0; n  rv; n++) {
  
  
  

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



  1   2   3   4   5   6   7   8   9   10   >