cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
jfclere 2004/06/04 01:33:27 Modified:jk/native2/common jk_channel_apr_socket.c Log: Nearly a typo ;-( Submitted by: John P. Eisenmenger (jpe at eisenmenger dot org) Revision ChangesPath 1.41 +1 -1 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- jk_channel_apr_socket.c 21 Mar 2004 09:43:09 - 1.40 +++ jk_channel_apr_socket.c 4 Jun 2004 08:33:27 - 1.41 @@ -90,7 +90,7 @@ socketInfo-timeout = atoi(value); } else if (strcmp(nodelay, name) == 0) { -socketInfo-timeout = atoi(value); +socketInfo-ndelay = atoi(value); } else { return jk2_channel_setAttribute(env, mbean, name, valueP); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
hgomez 2004/03/17 08:51:25 Modified:jk/native2/common jk_channel_apr_socket.c Log: Remove unused vars (thanks gcc -wall) Revision ChangesPath 1.39 +0 -4 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- jk_channel_apr_socket.c 1 Mar 2004 14:05:54 - 1.38 +++ jk_channel_apr_socket.c 17 Mar 2004 16:51:25 - 1.39 @@ -127,11 +127,9 @@ jk_channel_apr_private_t *socketInfo= (jk_channel_apr_private_t *)(ch-_privatePtr); int rc; -apr_port_t port=socketInfo-port; if( socketInfo-host==NULL ) { char *localName=ch-mbean-localName; -jk_config_t *cfg=ch-workerEnv-config; char *portIdx=strchr( localName, ':' ); @@ -364,8 +362,6 @@ apr_status_t stat; apr_size_t length; char data[128]; - -int sent=0; sock=endpoint-channelData; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
hgomez 2004/03/01 06:05:54 Modified:jk/native2/common jk_channel_apr_socket.c Log: We have less arguments than wanted in strings (varargs) Revision ChangesPath 1.38 +2 -2 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- jk_channel_apr_socket.c 24 Feb 2004 08:44:40 - 1.37 +++ jk_channel_apr_socket.c 1 Mar 2004 14:05:54 - 1.38 @@ -230,12 +230,12 @@ != APR_SUCCESS) { if (remote_sa-next) { env-l-jkLog(env, env-l, JK_LOG_DEBUG, - channelApr.open(): error %d creating socket %d %s\n, + channelApr.open(): error %d creating socket to %s\n, ret, socketInfo-host); } else { env-l-jkLog(env, env-l, JK_LOG_ERROR, - channelApr.open(): error %d creating socket %d %s\n, + channelApr.open(): error %d creating socket to %s\n, ret, socketInfo-host); } remote_sa = remote_sa-next; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
hgomez 2004/02/02 02:58:26 Modified:jk/native2/common jk_channel_apr_socket.c Log: Fix problem with port higher than 32K. Should fix BR 17579. Provided by NorW and Gunter Knauf Revision ChangesPath 1.36 +4 -4 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- jk_channel_apr_socket.c 29 Jan 2004 14:17:41 - 1.35 +++ jk_channel_apr_socket.c 2 Feb 2004 10:58:26 - 1.36 @@ -76,7 +76,7 @@ int ndelay; apr_sockaddr_t *addr; char *host; -short port; +apr_port_t port; int keepalive; int timeout; }; @@ -92,7 +92,7 @@ */ static int JK_METHOD jk2_channel_apr_resolve(jk_env_t *env, char *host, -short port, +apr_port_t port, jk_channel_apr_private_t *rc); static int JK_METHOD jk2_channel_apr_close(jk_env_t *env, jk_channel_t *_this, @@ -168,7 +168,7 @@ jk_channel_apr_private_t *socketInfo= (jk_channel_apr_private_t *)(ch-_privatePtr); int rc; -short port=socketInfo-port; +apr_port_t port=socketInfo-port; if( socketInfo-host==NULL ) { char *localName=ch-mbean-localName; @@ -227,7 +227,7 @@ /** private: resolve the address on init */ static int JK_METHOD jk2_channel_apr_resolve(jk_env_t *env, - char *host, short port, + char *host, apr_port_t port, jk_channel_apr_private_t *rc) { int err; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_endpoint.c jk_env.c jk_logger_file.c jk_mutex_proc.c jk_mutex_thread.c jk_pool_apr.c jk_registry.c jk_shm.c jk_vm_default.c jk_worker_ajp13.c jk_worker_lb.c jk_worker_status.c
mturk 2003/10/30 12:08:37 Modified:jk/native2/common jk_channel_apr_socket.c jk_endpoint.c jk_env.c jk_logger_file.c jk_mutex_proc.c jk_mutex_thread.c jk_pool_apr.c jk_registry.c jk_shm.c jk_vm_default.c jk_worker_ajp13.c jk_worker_lb.c jk_worker_status.c Log: Remove all the HAS_APR, and presume it is used bz default. User apr_socket as socket. Revision ChangesPath 1.34 +7 -32 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- jk_channel_apr_socket.c 16 Oct 2003 08:41:06 - 1.33 +++ jk_channel_apr_socket.c 30 Oct 2003 20:08:36 - 1.34 @@ -68,18 +68,8 @@ #include jk_env.h #include jk_channel.h #include jk_global.h - -#include string.h #include jk_registry.h - -#ifdef HAS_APR -#include apr_network_io.h -#include apr_errno.h -#include apr_general.h -#include apr_version.h - - #define DEFAULT_HOST 127.0.0.1 /** Information specific for the socket channel @@ -112,9 +102,9 @@ static char *jk2_channel_apr_socket_getAttributeInfo[]={host, port, keepalive, timeout, nodelay, graceful, - debug, disabled, NULL }; +debug, disabled, NULL }; static char *jk2_channel_apr_socket_setAttributeInfo[]={host, port, keepalive, timeout, nodelay, graceful, - debug, disabled, NULL }; +debug, disabled, NULL }; static int JK_METHOD jk2_channel_apr_setProperty(jk_env_t *env, jk_bean_t *mbean, @@ -226,13 +216,13 @@ static int JK_METHOD jk2_channel_apr_hasinput(jk_env_t *env, jk_channel_t *ch, jk_endpoint_t *endpoint, - int timeout) + int timeout) { - /* - * Should implements the APR select/poll for socket here - */ - return (JK_TRUE) ; +/* + * Should implements the APR select/poll for socket here + */ +return (JK_TRUE) ; } @@ -568,18 +558,3 @@ return JK_OK; } -#else /* HAS_APR */ - -int JK_METHOD jk2_channel_apr_socket_factory(jk_env_t *env, - jk_pool_t *pool, - jk_bean_t *result, - const char *type, const char *name) -{ - -result-disabled=1; -result-object= NULL; - -return JK_OK; -} - -#endif 1.26 +0 -2 jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c Index: jk_endpoint.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- jk_endpoint.c 26 Oct 2003 19:16:22 - 1.25 +++ jk_endpoint.c 30 Oct 2003 20:08:36 - 1.26 @@ -121,10 +121,8 @@ ep-stats-reqCnt=0; ep-stats-errCnt=0; -#ifdef HAS_APR ep-stats-maxTime=0; ep-stats-totalTime=0; -#endif bean-state=JK_STATE_INIT; 1.41 +0 -10 jakarta-tomcat-connectors/jk/native2/common/jk_env.c Index: jk_env.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_env.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- jk_env.c 25 Sep 2003 15:23:23 - 1.40 +++ jk_env.c 30 Oct 2003 20:08:36 - 1.41 @@ -58,9 +58,6 @@ #include jk_global.h #include jk_env.h #include jk_objCache.h -#ifdef HAS_APR -#include apr_general.h -#endif jk_env_t *jk_env_globalEnv; void *jkGlobalAprPool=NULL; @@ -76,7 +73,6 @@ /* Env management */ static void * JK_METHOD jk2_env_getAprPool( jk_env_t *env ) { -#ifdef HAS_APR /* We don't want to have to recreate the scoreboard after * restarts, so we'll create a global pool and never clean it. */ @@ -91,9 +87,6 @@ } } return jkGlobalAprPool; -#else -return NULL; -#endif } void JK_METHOD
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel_socket.c jk_worker_ajp13.c
hgomez 2003/10/16 01:41:06 Modified:jk/native2/common jk_channel_apr_socket.c jk_channel_socket.c jk_worker_ajp13.c Log: Now it compile Revision ChangesPath 1.33 +2 -3 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- jk_channel_apr_socket.c 16 Oct 2003 07:51:48 - 1.32 +++ jk_channel_apr_socket.c 16 Oct 2003 08:41:06 - 1.33 @@ -91,7 +91,6 @@ short port; int keepalive; int timeout; -int }; typedef struct jk_channel_apr_private jk_channel_apr_private_t; @@ -146,8 +145,8 @@ char *name ) { jk_channel_t *ch=(jk_channel_t *)bean-object; -jk_channel_socket_private_t *socketInfo= -(jk_channel_socket_private_t *)(ch-_privatePtr); +jk_channel_apr_private_t *socketInfo= +(jk_channel_apr_private_t *)(ch-_privatePtr); if( strcmp( name, name )==0 ) { return bean-name; 1.58 +2 -2 jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c Index: jk_channel_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- jk_channel_socket.c 16 Oct 2003 07:51:48 - 1.57 +++ jk_channel_socket.c 16 Oct 2003 08:41:06 - 1.58 @@ -244,7 +244,7 @@ static int JK_METHOD jk2_channel_socket_hasinput(jk_env_t *env, jk_channel_t *ch, jk_endpoint_t *endpoint, - int timeout) + int timeout) { fd_set rset; fd_set eset; @@ -259,7 +259,7 @@ tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; - rc = select(ae-sd + 1, rset, NULL, eset, tv); + rc = select(endpoint-sd + 1, rset, NULL, eset, tv); if ((rc 1) || (FD_ISSET(endpoint-sd, eset))) { 1.51 +4 -5 jakarta-tomcat-connectors/jk/native2/common/jk_worker_ajp13.c Index: jk_worker_ajp13.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_ajp13.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- jk_worker_ajp13.c 16 Oct 2003 07:51:48 - 1.50 +++ jk_worker_ajp13.c 16 Oct 2003 08:41:06 - 1.51 @@ -124,7 +124,7 @@ } else if (strcmp( name, graceful )==0 ) { return jk2_env_itoa( env, worker-graceful ); } else if (strcmp( name, connectTimeout )==0 ) { -return jk2_env_itoa( env, worket-connect_timeout); +return jk2_env_itoa( env, worker-connect_timeout); } else if (strcmp( name, replyTimeout )==0 ) { return jk2_env_itoa( env, worker-reply_timeout); } else if (strcmp( name, prepostTimeout )==0 ) { @@ -277,9 +277,9 @@ */ static int jk2_check_alive(jk_env_t *env, jk_endpoint_t *ae, int timeout) { +int err; jk_channel_t *channel=ae-worker-channel; jk_msg_t * msg=ae-reply; -; jk2_serialize_cping( env, msg, ae ); err = ae-worker-channel-send( env, ae-worker-channel, ae, msg ); @@ -312,7 +312,6 @@ return JK_ERR; } - return JK_OK; } @@ -353,7 +352,7 @@ /** XXX use a 'connected' field */ if( ae-sd == -1 ) ae-sd=0; - if (ae-worker-connect_timeout != 0 ) + if (ae-worker-connect_timeout != 0 ) { if (jk2_check_alive(env, ae, ae-worker-connect_timeout) != JK_OK) return JK_ERR; } @@ -582,7 +581,7 @@ s-content_read=0; if (w-prepost_timeout != 0) { - if (jk2_check_alive(env, ae, ae-worker-prepost_timeout) != JK_OK) + if (jk2_check_alive(env, e, e-worker-prepost_timeout) != JK_OK) return JK_ERR; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
hgomez 2003/09/30 06:42:02 Modified:jk/native2/server/apache2 mod_jk2.c jk_service_apache2.c jk_apache2.h jk/native2/common jk_channel_apr_socket.c Log: Update for APR 1.0 (Apache 2.1) Provided by Günter Knauf eflash at gmx.net Revision ChangesPath 1.64 +7 -7 jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c Index: mod_jk2.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- mod_jk2.c 25 Sep 2003 15:23:23 - 1.63 +++ mod_jk2.c 30 Sep 2003 13:42:02 - 1.64 @@ -242,9 +242,9 @@ if (s-is_virtual s-server_hostname != NULL (uriEnv-virtual==NULL || !strchr(uriEnv-virtual, ':') || uriEnv-port != s-port)) { -tmp_virtual = (char *) ap_pcalloc(cmd-pool, +tmp_virtual = (char *) apr_pcalloc(cmd-pool, sizeof(char *) * (strlen(s-server_hostname) + 8 )) ; -tmp_full_url = (char *) ap_pcalloc(cmd-pool, +tmp_full_url = (char *) apr_pcalloc(cmd-pool, sizeof(char *) * (strlen(s-server_hostname) + strlen(uriEnv-uri)+8 )) ; /* do not pass the hostname:0/ scheme */ @@ -310,7 +310,7 @@ /* Original patch: a * sizeof( char * ) - that's weird, we only use a chars, not char* Maybe I wrote too much java... */ -tmp = (char *) ap_pcalloc(p, a); +tmp = (char *) apr_pcalloc(p, a); sprintf(tmp, %s-%d, path, dirCounter++); /* I changed the default to /, otherwise it complains */ @@ -538,7 +538,7 @@ int i; for( i=0; i10; i++ ) { -tmpPool=apr_pool_get_parent( gPool ); +tmpPool=apr_pool_parent_get( gPool ); if( tmpPool == NULL ) { /* fprintf(stderr, XXX Found Root pool %#lx\n, gPool ); */ break; @@ -890,11 +890,11 @@ if( uriEnv != NULL ) { /* First find just the name of the file, no directory */ -r-filename = (char *)apr_filename_of_pathname(r-uri); +r-filename = (char *)apr_filepath_name_get(r-uri); /* Only if sub-request for a directory, most likely from mod_dir */ if (r-main r-main-filename -!*apr_filename_of_pathname(r-main-filename)){ +!*apr_filepath_name_get(r-main-filename)){ /* The filename from the main request will be set to what should * be picked up, aliases included. Tomcat will need to know about 1.36 +3 -3 jakarta-tomcat-connectors/jk/native2/server/apache2/jk_service_apache2.c Index: jk_service_apache2.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/jk_service_apache2.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- jk_service_apache2.c 25 Sep 2003 15:23:23 - 1.35 +++ jk_service_apache2.c 30 Sep 2003 13:42:02 - 1.36 @@ -116,7 +116,7 @@ * If the script gave us a Last-Modified header, we can't just * pass it on blindly because of restrictions on future values. */ -ap_update_mtime(r, ap_parseHTTPdate(val)); +ap_update_mtime(r, apr_date_parse_http(val)); ap_set_last_modified(r); } @@ -162,7 +162,7 @@ * If the script gave us a Last-Modified header, we can't just * pass it on blindly because of restrictions on future values. */ -ap_update_mtime(r, ap_parseHTTPdate(val)); +ap_update_mtime(r, apr_date_parse_http(val)); ap_set_last_modified(r); apr_table_set(r-headers_out, name, val); } else { 1.13 +8 -2 jakarta-tomcat-connectors/jk/native2/server/apache2/jk_apache2.h Index: jk_apache2.h === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/jk_apache2.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- jk_apache2.h 25 Sep 2003 15:23:23 - 1.12 +++ jk_apache2.h 30 Sep 2003 13:42:02 - 1.13 @@ -65,7 +65,6 @@ #ifndef JK_APACHE2_H #define JK_APACHE2_H -#include apu_compat.h #include ap_config.h #include apr_lib.h #include apr_date.h @@ -91,6 +90,13 @@ #include jk_workerEnv.h #include jk_uriMap.h #include jk_requtil.h + +/* changed with apr 1.0 */ +#include apr_version.h +#if (APR_MAJOR_VERSION 1) +#define apr_filepath_name_get apr_filename_of_pathname
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
jfclere 2003/04/03 08:05:53 Modified:jk/native2/common jk_channel_apr_socket.c Log: Fix syntax error. Submitted by Jeff Trawick trawick at attglobal.net Revision ChangesPath 1.30 +24 -8 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- jk_channel_apr_socket.c 4 Feb 2003 07:39:59 - 1.29 +++ jk_channel_apr_socket.c 3 Apr 2003 16:05:53 - 1.30 @@ -226,9 +226,16 @@ if ((ret = apr_socket_create(sock, remote_sa-family, SOCK_STREAM, (apr_pool_t *)env-globalPool-_private)) != APR_SUCCESS) { -env-l-jkLog(env, env-l, remote_sa-next ? JK_LOG_DEBUG : JK_LOG_ERROR, - channelApr.open(): error %d creating socket %d %s\n, - ret, socketInfo-host); +if (remote_sa-next) { +env-l-jkLog(env, env-l, JK_LOG_DEBUG, + channelApr.open(): error %d creating socket %d %s\n, + ret, socketInfo-host); +} +else { +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channelApr.open(): error %d creating socket %d %s\n, + ret, socketInfo-host); +} remote_sa = remote_sa-next; continue; } @@ -255,11 +262,20 @@ /* if an error occurred, loop round and try again */ if (ret != APR_SUCCESS) { apr_socket_close(sock); -env-l-jkLog(env, env-l, remote_sa-next ? JK_LOG_DEBUG : JK_LOG_ERROR, - channelApr.open() attempt to connect to %pI (%s) failed %d\n, - remote_sa, - socketInfo-host, - ret); +if (remote_sa-next) { +env-l-jkLog(env, env-l, JK_LOG_DEBUG, + channelApr.open() attempt to connect to %pI (%s) failed %d\n, + remote_sa, + socketInfo-host, + ret); +} +else { +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channelApr.open() attempt to connect to %pI (%s) failed %d\n, + remote_sa, + socketInfo-host, + ret); +} remote_sa = remote_sa-next; continue; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
mturk 2002/10/04 03:12:53 Modified:jk/native2/common jk_channel_apr_socket.c Log: Fix the apr_socket default timeout value. Also fix the send/recv that caused wrong header readings. Revision ChangesPath 1.28 +32 -22 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- jk_channel_apr_socket.c 3 Oct 2002 01:33:14 - 1.27 +++ jk_channel_apr_socket.c 4 Oct 2002 10:12:52 - 1.28 @@ -216,7 +216,7 @@ int ndelay=socketInfo-ndelay; int keepalive=socketInfo-keepalive; -apr_socket_t *sock=endpoint-channelData; +apr_socket_t *sock; apr_status_t ret; apr_int32_t timeout = (apr_int32_t)(socketInfo-timeout * APR_USEC_PER_SEC); char msg[128]; @@ -232,7 +232,8 @@ remote_sa = remote_sa-next; continue; } - +/* store the channel information */ +endpoint-channelData=sock; env-l-jkLog(env, env-l, JK_LOG_INFO, channelApr.open(): create tcp socket %d\n, sock ); @@ -240,8 +241,9 @@ /* the default timeout (0) will set the socket to blocking with infinite timeouts. */ + if (timeout = 0) -apr_socket_timeout_set(sock, 0); +apr_socket_timeout_set(sock, -1); else apr_socket_timeout_set(sock, timeout); @@ -296,9 +298,6 @@ env-l-jkLog(env, env-l, JK_LOG_DEBUG, channelApr.open(), sock = %d\n, sock); -/* store the channel information */ -endpoint-channelData=sock; - return JK_OK; } @@ -360,13 +359,20 @@ b=msg-buf; length = (apr_size_t) len; -stat = apr_send(sock, b, length); -if (stat!= APR_SUCCESS) { -env-l-jkLog(env, env-l, JK_LOG_ERROR, - jk2_channel_apr_send send failed %d %s\n, - stat, apr_strerror( stat, data, sizeof(data) ) ); -return -3; /* -2 is not possible... */ -} +do { +apr_size_t written = length; + +stat = apr_send(sock, b, written); +if (stat!= APR_SUCCESS) { +env-l-jkLog(env, env-l, JK_LOG_ERROR, +jk2_channel_apr_send send failed %d %s\n, +stat, apr_strerror( stat, data, sizeof(data) ) ); +return -3; /* -2 is not possible... */ +} +length -= written; +b += written; +} while (length); + return JK_OK; } @@ -395,17 +401,21 @@ return JK_ERR; rdlen = 0; +length = (apr_size_t)len; +while (rdlen len) { -length = (apr_size_t) len; -stat = apr_recv(sock, b, length); +stat = apr_recv(sock, b + rdlen, length); -if ( stat == APR_EOF) -return -1; /* socket closed. */ -else if ( stat == APR_SUCCESS) { -rdlen = (int) length; -return rdlen; -} else -return -1; /* any error. */ +if (stat == APR_EOF) +return -1; /* socket closed. */ +else if (APR_STATUS_IS_EAGAIN(stat)) +continue; +else if (stat != APR_SUCCESS) +return -1; /* any error. */ +rdlen += length; +length = (apr_size_t)(len - rdlen); +} +return rdlen; } /** receive len bytes. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
mturk 2002/10/02 05:50:05 Modified:jk/native2/common jk_channel_apr_socket.c Log: Enable connecting to other IP addreses of the same host if the first one is down, checking all of them. This is only the case when the specified server name is not in the dot-ip notation. Revision ChangesPath 1.26 +45 -41 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- jk_channel_apr_socket.c 27 Sep 2002 13:07:28 - 1.25 +++ jk_channel_apr_socket.c 2 Oct 2002 12:50:05 - 1.26 @@ -219,51 +219,55 @@ apr_socket_t *sock=endpoint-channelData; apr_status_t ret; apr_int32_t timeout = (apr_int32_t)(socketInfo-timeout * APR_USEC_PER_SEC); -char msg[128]; +char msg[128]; +int connected = 0; + +while (remote_sa !connected) { +if ((ret = apr_socket_create(sock, remote_sa-family, SOCK_STREAM, + (apr_pool_t *)env-globalPool-_private)) +!= APR_SUCCESS) { +env-l-jkLog(env, env-l, remote_sa-next ? JK_LOG_DEBUG : JK_LOG_ERROR, + channelApr.open(): error %d creating socket %d %s\n, + ret, socketInfo-host); +remote_sa = remote_sa-next; +continue; +} + -if (apr_socket_create(sock, remote_sa-family, SOCK_STREAM, - (apr_pool_t *)env-globalPool-_private) - != APR_SUCCESS) { -env-l-jkLog(env, env-l, JK_LOG_ERROR, - channelApr.open(): can't create socket %d %s\n, - errno, strerror( errno ) ); -return JK_ERR; -} -env-l-jkLog(env, env-l, JK_LOG_INFO, - channelApr.open(): create tcp socket %d\n, sock ); - -/* the default timeout (0) will set the socket to blocking with - infinite timeouts. - */ -if (timeout = 0) -timeout = -1; -if (apr_setsocketopt(sock, APR_SO_TIMEOUT, timeout)!= APR_SUCCESS) { -env-l-jkLog(env, env-l, JK_LOG_ERROR, - channelApr.open(): can't set timeout %d %s\n, - errno, strerror( errno ) ); -return JK_ERR; -} - -/* Tries to connect to JServ (continues trying while error is EINTR) */ -do { env-l-jkLog(env, env-l, JK_LOG_INFO, - channelApr.open() connect on %d\n,sock); -ret = apr_connect(sock, remote_sa); -env-l-jkLog(env, env-l, JK_LOG_INFO, - jk2_channel_apr_open: %d %s %s\n,ret, strerror( errno ), - socketInfo-host); - -} while (ret == APR_EINTR); +channelApr.open(): create tcp socket %d\n, sock ); + +/* the default timeout (0) will set the socket to blocking with + infinite timeouts. +*/ +if (timeout = 0) +apr_socket_timeout_set(sock, 0); +else +apr_socket_timeout_set(sock, timeout); + +/* make the connection out of the socket */ +do { +ret = apr_connect(sock, remote_sa); +} while (APR_STATUS_IS_EINTR(ret)); + +/* if an error occurred, loop round and try again */ +if (ret != APR_SUCCESS) { +apr_socket_close(sock); +env-l-jkLog(env, env-l, remote_sa-next ? JK_LOG_DEBUG : JK_LOG_ERROR, + channelApr.open() attempt to connect to %pI (%s) failed %d\n, + remote_sa, + socketInfo-host, + ret); +remote_sa = remote_sa-next; +continue; +} +connected = 1; +} -/* Check if we connected */ -if(ret != APR_SUCCESS ) { -apr_socket_close(sock); -env-l-jkLog(env, env-l, JK_LOG_ERROR, - channelApr.open() connect failed %d %s\n, - ret, apr_strerror( ret, msg, sizeof(msg) ) ); -return JK_ERR; +if (!connected) { +apr_socket_close(sock); +return JK_ERR; } - /* enable the use of keep-alive packets on TCP connection */ if(keepalive) { int set = 1; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_uriEnv.c jk_uriMap.c jk_worker_jni.c jk_worker_lb.c
nacho 2002/10/02 18:33:15 Modified:jk/native2/common jk_channel_apr_socket.c jk_uriEnv.c jk_uriMap.c jk_worker_jni.c jk_worker_lb.c Log: Problems with EOL I was unable to catch any of the multiple times this issue was discussed on the list, but again.. Committing files with diferent EOL than the plataform we are working on, damages them in CVS.. there are many ways to do this, but one of the most commons is to have the sources in a linux i.e., edit them in win32 with an editor the completes the lf with a cr and commit then form linux.. I suppouse that are many combinations for that circunstance, take care.. Maybe old cygwin versions are problematic too , i dont know.. Revision ChangesPath 1.27 +32 -32 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- jk_channel_apr_socket.c 2 Oct 2002 12:50:05 - 1.26 +++ jk_channel_apr_socket.c 3 Oct 2002 01:33:14 - 1.27 @@ -219,20 +219,20 @@ apr_socket_t *sock=endpoint-channelData; apr_status_t ret; apr_int32_t timeout = (apr_int32_t)(socketInfo-timeout * APR_USEC_PER_SEC); -char msg[128]; +char msg[128]; int connected = 0; - + while (remote_sa !connected) { if ((ret = apr_socket_create(sock, remote_sa-family, SOCK_STREAM, (apr_pool_t *)env-globalPool-_private)) != APR_SUCCESS) { env-l-jkLog(env, env-l, remote_sa-next ? JK_LOG_DEBUG : JK_LOG_ERROR, channelApr.open(): error %d creating socket %d %s\n, - ret, socketInfo-host); -remote_sa = remote_sa-next; -continue; -} - + ret, socketInfo-host); +remote_sa = remote_sa-next; +continue; +} + env-l-jkLog(env, env-l, JK_LOG_INFO, channelApr.open(): create tcp socket %d\n, sock ); @@ -240,33 +240,33 @@ /* the default timeout (0) will set the socket to blocking with infinite timeouts. */ -if (timeout = 0) -apr_socket_timeout_set(sock, 0); -else +if (timeout = 0) +apr_socket_timeout_set(sock, 0); +else apr_socket_timeout_set(sock, timeout); - -/* make the connection out of the socket */ -do { -ret = apr_connect(sock, remote_sa); -} while (APR_STATUS_IS_EINTR(ret)); - -/* if an error occurred, loop round and try again */ -if (ret != APR_SUCCESS) { -apr_socket_close(sock); -env-l-jkLog(env, env-l, remote_sa-next ? JK_LOG_DEBUG : JK_LOG_ERROR, - channelApr.open() attempt to connect to %pI (%s) failed %d\n, - remote_sa, - socketInfo-host, - ret); -remote_sa = remote_sa-next; -continue; -} -connected = 1; -} -if (!connected) { -apr_socket_close(sock); -return JK_ERR; +/* make the connection out of the socket */ +do { +ret = apr_connect(sock, remote_sa); +} while (APR_STATUS_IS_EINTR(ret)); + +/* if an error occurred, loop round and try again */ +if (ret != APR_SUCCESS) { +apr_socket_close(sock); +env-l-jkLog(env, env-l, remote_sa-next ? JK_LOG_DEBUG : JK_LOG_ERROR, + channelApr.open() attempt to connect to %pI (%s) failed %d\n, + remote_sa, + socketInfo-host, + ret); +remote_sa = remote_sa-next; +continue; +} +connected = 1; +} + +if (!connected) { +apr_socket_close(sock); +return JK_ERR; } /* enable the use of keep-alive packets on TCP connection */ if(keepalive) { 1.36 +11 -11jakarta-tomcat-connectors/jk/native2/common/jk_uriEnv.c Index: jk_uriEnv.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_uriEnv.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- jk_uriEnv.c 2 Oct 2002 10:27:17 - 1.35 +++ jk_uriEnv.c 3 Oct 2002 01:33:14 - 1.36 @@ -104,7
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
mturk 2002/07/08 06:42:03 Modified:jk/native2/common jk_channel_apr_socket.c Log: no message Revision ChangesPath 1.24 +1 -1 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- jk_channel_apr_socket.c 27 Jun 2002 17:19:09 - 1.23 +++ jk_channel_apr_socket.c 8 Jul 2002 13:42:03 - 1.24 @@ -289,7 +289,7 @@ } if( ch-mbean-debug 0 ) -env-l-jkLog(env, env-l, JK_LOG_INFO, +env-l-jkLog(env, env-l, JK_LOG_DEBUG, channelApr.open(), sock = %d\n, sock); /* store the channel information */ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
mturk 2002/06/27 10:19:09 Modified:jk/native2/common jk_channel_apr_socket.c Log: Added socket keepalive and send/recv timeout options. keepalive=1/0 (enabled/disabled) timeout=nn (seconds) defaults to unlimited Added nodelay option (default disabled) nodelay=1/0 (enabled/disabled) Revision ChangesPath 1.23 +42 -11 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- jk_channel_apr_socket.c 10 Jun 2002 21:55:06 - 1.22 +++ jk_channel_apr_socket.c 27 Jun 2002 17:19:09 - 1.23 @@ -88,6 +88,8 @@ apr_sockaddr_t *addr; char *host; short port; +int keepalive; +int timeout; }; typedef struct jk_channel_apr_private jk_channel_apr_private_t; @@ -121,6 +123,12 @@ socketInfo-host=value; } else if( strcmp( port, name ) == 0 ) { socketInfo-port=atoi( value ); +} else if( strcmp( keepalive, name ) == 0 ) { +socketInfo-keepalive=atoi( value ); +} else if( strcmp( timeout, name ) == 0 ) { +socketInfo-timeout=atoi( value ); +} else if( strcmp( nodelay, name ) == 0 ) { +socketInfo-timeout=atoi( value ); } else { return jk2_channel_setAttribute( env, mbean, name, valueP ); } @@ -206,10 +214,11 @@ apr_sockaddr_t *remote_sa=socketInfo-addr; int ndelay=socketInfo-ndelay; +int keepalive=socketInfo-keepalive; apr_socket_t *sock=endpoint-channelData; apr_status_t ret; -apr_interval_time_t timeout = 2 * APR_USEC_PER_SEC; +apr_int32_t timeout = socketInfo-timeout * APR_USEC_PER_SEC; char msg[128]; if (apr_socket_create(sock, remote_sa-family, SOCK_STREAM, @@ -223,6 +232,11 @@ env-l-jkLog(env, env-l, JK_LOG_INFO, channelApr.open(): create tcp socket %d\n, sock ); +/* the default timeout (0) will set the socket to blocking with + infinite timeouts. + */ +if (timeout = 0) +timeout = -1; if (apr_setsocketopt(sock, APR_SO_TIMEOUT, timeout)!= APR_SUCCESS) { env-l-jkLog(env, env-l, JK_LOG_ERROR, channelApr.open(): can't set timeout %d %s\n, @@ -235,7 +249,7 @@ env-l-jkLog(env, env-l, JK_LOG_INFO, channelApr.open() connect on %d\n,sock); ret = apr_connect(sock, remote_sa); -env-l-jkLog(env, env-l, JK_LOG_ERROR, +env-l-jkLog(env, env-l, JK_LOG_INFO, jk2_channel_apr_open: %d %s %s\n,ret, strerror( errno ), socketInfo-host); @@ -245,20 +259,38 @@ if(ret != APR_SUCCESS ) { apr_socket_close(sock); env-l-jkLog(env, env-l, JK_LOG_ERROR, - channelApr.connect() connect failed %d %s\n, + channelApr.open() connect failed %d %s\n, ret, apr_strerror( ret, msg, sizeof(msg) ) ); return JK_ERR; } + +/* enable the use of keep-alive packets on TCP connection */ +if(keepalive) { +int set = 1; +if((ret = apr_setsocketopt(sock, APR_SO_KEEPALIVE, set)) != APR_SUCCESS ) { +apr_socket_close(sock); +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channelApr.open() keepalive failed %d %s\n, + ret, apr_strerror( ret, msg, sizeof(msg) ) ); +return JK_ERR; +} +} -/* XXX needed? +/* Disable the Nagle algorithm if ndelay is set */ if(ndelay) { int set = 1; -setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,(char *)set,sizeof(set)); +if((ret = apr_setsocketopt(sock, APR_TCP_NODELAY, set)) != APR_SUCCESS ) { +apr_socket_close(sock); +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channelApr.open() nodelay failed %d %s\n, + ret, apr_strerror( ret, msg, sizeof(msg) ) ); +return JK_ERR; +} } -env-l-jkLog(env, env-l, JK_LOG_INFO, - channelApr.connect(), sock = %d\n, sock); -*/ +if( ch-mbean-debug 0 ) +env-l-jkLog(env, env-l, JK_LOG_INFO, + channelApr.open(), sock = %d\n, sock); /* store the channel information */ endpoint-channelData=sock; @@ -421,11 +453,11 @@ const char *type, const char *name) { jk_channel_t *ch; - + ch=(jk_channel_t
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel.c jk_channel_jni.c jk_channel_socket.c jk_channel_un.c
costin 02/05/30 11:05:08 Modified:jk/native2/common jk_channel_apr_socket.c jk_channel.c jk_channel_jni.c jk_channel_socket.c jk_channel_un.c Log: Use the common super method for setAttribute. This allows setDisabled() on channel to propagate to worker, and reduce the code duplication. Added the JK_INVOKE_WITH_RESPONSE case to read(). Revision ChangesPath 1.21 +1 -4 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- jk_channel_apr_socket.c 26 May 2002 07:30:01 - 1.20 +++ jk_channel_apr_socket.c 30 May 2002 18:05:08 - 1.21 @@ -122,10 +122,7 @@ } else if( strcmp( port, name ) == 0 ) { socketInfo-port=atoi( value ); } else { - if( ch-worker!=NULL ) { -return ch-worker-mbean-setAttribute( env, ch-worker-mbean, name, valueP ); -} -return JK_ERR; +return jk2_channel_setAttribute( env, mbean, name, valueP ); } return JK_OK; } 1.3 +28 -0 jakarta-tomcat-connectors/jk/native2/common/jk_channel.c Index: jk_channel.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_channel.c 28 May 2002 22:40:25 - 1.2 +++ jk_channel.c 30 May 2002 18:05:08 - 1.3 @@ -69,6 +69,32 @@ #include string.h #include jk_registry.h +/** Common attributes for all channels + */ +int JK_METHOD jk2_channel_setAttribute(jk_env_t *env, + jk_bean_t *mbean, + char *name, void *valueP) +{ +jk_channel_t *ch=(jk_channel_t *)mbean-object; +char *value=valueP; + +if( strcmp( debug, name ) == 0 ) { +ch-mbean-debug=atoi( value ); +} else if( strcmp( disabled, name ) == 0 ) { +ch-mbean-disabled=atoi( value ); +if( ch-worker!=NULL) +ch-worker-mbean-disabled=ch-mbean-disabled; +} else { + if( ch-worker!=NULL ) { +return ch-worker-mbean-setAttribute( env, ch-worker-mbean, name, valueP ); +} +return JK_ERR; +} +return JK_OK; +} + + + /** Called by java ( local or remote ). */ int JK_METHOD jk2_channel_invoke(jk_env_t *env, jk_bean_t *bean, jk_endpoint_t *ep, int code, @@ -101,6 +127,8 @@ env-l-jkLog(env, env-l, JK_LOG_INFO, ch.recv()\n); if( ch-recv != NULL ) rc=ch-recv(env, ch, ep, msg); +if( rc==JK_OK ) +return JK_INVOKE_WITH_RESPONSE; return rc; } case CH_WRITE: { 1.24 +2 -14 jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c Index: jk_channel_jni.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- jk_channel_jni.c 27 May 2002 15:54:44 - 1.23 +++ jk_channel_jni.c 30 May 2002 18:05:08 - 1.24 @@ -106,19 +106,6 @@ -static int JK_METHOD jk2_channel_jni_setAttribute(jk_env_t *env, - jk_bean_t *mbean, - char *name, void *valueP) -{ -jk_channel_t *ch=(jk_channel_t *)mbean-object; -char *value=valueP; - -if( ch-worker!=NULL ) { -return ch-worker-mbean-setAttribute( env, ch-worker-mbean, name, valueP ); -} -return JK_OK; -} - static int JK_METHOD jk2_channel_jni_init(jk_env_t *env, jk_bean_t *jniWB) { @@ -553,7 +540,8 @@ sizeof(jk_channel_jni_private_t)); ch-is_stream=JK_FALSE; -result-setAttribute= jk2_channel_jni_setAttribute; +/* No special attribute */ +result-setAttribute= jk2_channel_setAttribute; ch-mbean=result; result-object= ch; result-init= jk2_channel_jni_init; 1.30 +1 -4 jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c Index: jk_channel_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- jk_channel_socket.c 26
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_channel_socket.c jk_channel_un.c jk_workerEnv.c
costin 02/05/26 00:30:01 Modified:jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_channel_socket.c jk_channel_un.c jk_workerEnv.c Log: Moved channels to use the init() method in jk_bean. ( all jk components will eventually be useable from java using the ajp 'bridge', but channels are important and need to be initialized corectly ) Revision ChangesPath 1.20 +3 -2 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- jk_channel_apr_socket.c 16 May 2002 23:48:27 - 1.19 +++ jk_channel_apr_socket.c 26 May 2002 07:30:01 - 1.20 @@ -133,8 +133,9 @@ /** resolve the host IP ( jk_resolve ) and initialize the channel. */ static int JK_METHOD jk2_channel_apr_init(jk_env_t *env, - jk_channel_t *ch) + jk_bean_t *chB) { +jk_channel_t *ch=chB-object; jk_channel_apr_private_t *socketInfo= (jk_channel_apr_private_t *)(ch-_privatePtr); int rc; @@ -431,7 +432,6 @@ ch-recv= jk2_channel_apr_recv; ch-send= jk2_channel_apr_send; -ch-init= jk2_channel_apr_init; ch-open= jk2_channel_apr_open; ch-close= jk2_channel_apr_close; ch-is_stream=JK_TRUE; @@ -439,6 +439,7 @@ result-setAttribute= jk2_channel_apr_setProperty; ch-mbean=result; result-object= ch; +result-init= jk2_channel_apr_init; ch-workerEnv=env-getByName( env, workerEnv ); ch-workerEnv-addChannel( env, ch-workerEnv, ch ); 1.22 +8 -10 jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c Index: jk_channel_jni.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- jk_channel_jni.c 19 May 2002 21:41:25 - 1.21 +++ jk_channel_jni.c 26 May 2002 07:30:01 - 1.22 @@ -106,7 +106,7 @@ -static int JK_METHOD jk2_channel_jni_setProperty(jk_env_t *env, +static int JK_METHOD jk2_channel_jni_setAttribute(jk_env_t *env, jk_bean_t *mbean, char *name, void *valueP) { @@ -120,8 +120,9 @@ } static int JK_METHOD jk2_channel_jni_init(jk_env_t *env, - jk_channel_t *jniW) + jk_bean_t *jniWB) { +jk_channel_t *jniW=jniWB-object; jk_workerEnv_t *wEnv=jniW-workerEnv; if( wEnv-vm == NULL ) { @@ -156,7 +157,7 @@ return JK_OK; } -env-l-jkLog(env, env-l, JK_LOG_INFO,channel_jni.init(): \n ); +env-l-jkLog(env, env-l, JK_LOG_INFO,channel_jni.open(): \n ); if( _this-worker != NULL ) _this-worker-mbean-disabled=JK_TRUE; @@ -313,10 +314,7 @@ if( epData-jniJavaContext != NULL){ (*jniEnv)-DeleteGlobalRef( jniEnv, epData-jniJavaContext ); } -endpoint-mbean-pool-realloc(env,endpoint-mbean-pool,0, -epData-carray,epData-arrayLen); -endpoint-mbean-pool-realloc(env,endpoint-mbean-pool,0, -epData,sizeof( jk_ch_jni_ep_private_t )); + endpoint-channelData=NULL; return JK_OK; @@ -404,7 +402,7 @@ nbuf = (*jniEnv)-GetPrimitiveArrayCritical(jniEnv, jbuf, iscopy); #else nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, jbuf, iscopy); -#endif + #endif if( iscopy ) env-l-jkLog(env, env-l, JK_LOG_INFO, channelJni.send() get java bytes iscopy %d\n, iscopy); @@ -545,7 +543,6 @@ ch-recv= jk2_channel_jni_recv; ch-send= jk2_channel_jni_send; -ch-init= jk2_channel_jni_init; ch-open= jk2_channel_jni_open; ch-close= jk2_channel_jni_close; @@ -556,9 +553,10 @@ sizeof(jk_channel_jni_private_t)); ch-is_stream=JK_FALSE; -result-setAttribute= jk2_channel_jni_setProperty; +result-setAttribute= jk2_channel_jni_setAttribute; ch-mbean=result; result-object= ch; +result-init= jk2_channel_jni_init; wEnv=env-getByName( env, workerEnv ); ch-workerEnv=wEnv; 1.29 +3 -2 jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c Index: jk_channel_socket.c === RCS file:
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_env.c jk_pool_apr.c jk_shm.c jk_uriEnv.c jk_vm_default.c jk_workerEnv.c jk_worker_jni.c jk_worker_status.c
costin 02/05/16 16:48:28 Modified:jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_env.c jk_pool_apr.c jk_shm.c jk_uriEnv.c jk_vm_default.c jk_workerEnv.c jk_worker_jni.c jk_worker_status.c Log: All files will compile now, with some generating empty factories if the feature is not enabled. Use 'lb' instead of 'worker.lb' and 'ajp13' instead of 'worker.ajp13'. ( it's better to use a simpler name, and it remove another confusing use of 'worker' name ) Remove some of the workarounds and tricks - the code is now stable and well, it's better to fix the remaining bugs then to work around. Revision ChangesPath 1.19 +21 -4 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- jk_channel_apr_socket.c 16 May 2002 21:03:44 - 1.18 +++ jk_channel_apr_socket.c 16 May 2002 23:48:27 - 1.19 @@ -62,10 +62,6 @@ * @author: Costin Manolache * @author: Jean-Frederic Clere [EMAIL PROTECTED] */ -#include apr_network_io.h -#include apr_errno.h -#include apr_general.h - #include jk_global.h #include jk_map.h @@ -77,6 +73,11 @@ #include jk_registry.h +#ifdef HAS_APR +#include apr_network_io.h +#include apr_errno.h +#include apr_general.h + #define DEFAULT_HOST 127.0.0.1 @@ -444,3 +445,19 @@ return JK_OK; } +#else /* HAS_APR */ + +int JK_METHOD jk2_channel_apr_socket_factory(jk_env_t *env, + jk_pool_t *pool, + jk_bean_t *result, + const char *type, const char *name) +{ + +result-disabled=1; +result-object= NULL; + +return JK_OK; +} + + +#endif 1.20 +18 -0 jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c Index: jk_channel_jni.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- jk_channel_jni.c 16 May 2002 21:03:44 - 1.19 +++ jk_channel_jni.c 16 May 2002 23:48:27 - 1.20 @@ -62,6 +62,12 @@ * @author: Costin Manolache */ +#include jk_workerEnv.h +#include jk_env.h +#include jk_bean.h + +#ifdef HAVE_JNI + #include jk_map.h #include jk_env.h #include jk_channel.h @@ -540,3 +546,15 @@ return JK_OK; } + +#else + +int JK_METHOD jk2_channel_jni_factory(jk_env_t *env, jk_pool_t *pool, + jk_bean_t *result, + const char *type, const char *name) +{ +result-disabled=1; +return JK_OK; +} + +#endif 1.26 +9 -8 jakarta-tomcat-connectors/jk/native2/common/jk_env.c Index: jk_env.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_env.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- jk_env.c 16 May 2002 21:03:44 - 1.25 +++ jk_env.c 16 May 2002 23:48:27 - 1.26 @@ -164,9 +164,10 @@ /* Funny pointer arithmetic. I hope I got it right */ type=env-tmpPool-calloc( env, env-tmpPool, localName - objName + 2 ); strncpy( type, objName, localName - objName ); +localName++; } -return env-createBean2( env, pool, type, objName ); +return env-createBean2( env, pool, type, localName ); } /** Create a component using type and local part ( pre-cooked ). @@ -199,14 +200,14 @@ return NULL; } -if( localName!=NULL strncmp( localName, type, strlen( type )) == 0 ) { +/* if( localName!=NULL strncmp( localName, type, strlen( type )) == 0 ) { */ /* Common error, make it 'localName' */ -if( strcmp( type, localName ) == 0 ) { -localName=; -} else { -localName= localName + strlen(type) + 1; -} -} +/* if( strcmp( type, localName ) == 0 ) { */ +/* localName=; */ +/* } else { */ +/* localName= localName + strlen(type) + 1; */ +/* } */ +/* } */ if( env-debug 0 ) { if( env-l != NULL ) { 1.4 +3 -0 jakarta-tomcat-connectors/jk/native2/common/jk_pool_apr.c Index: jk_pool_apr.c
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c
costin 02/05/15 12:34:09 Modified:jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c Log: Few cosmetic changes - simplify the code Revision ChangesPath 1.17 +13 -27 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- jk_channel_apr_socket.c 12 May 2002 01:08:45 - 1.16 +++ jk_channel_apr_socket.c 15 May 2002 19:34:09 - 1.17 @@ -89,12 +89,6 @@ short port; }; -/** Informations for each connection - */ -typedef struct jk_channel_apr_data { -apr_socket_t *sock; -} jk_channel_apr_data_t; - typedef struct jk_channel_apr_private jk_channel_apr_private_t; /* @@ -214,9 +208,8 @@ apr_sockaddr_t *remote_sa=socketInfo-addr; int ndelay=socketInfo-ndelay; -jk_channel_apr_data_t *sd=endpoint-channelData; -apr_socket_t *sock; +apr_socket_t *sock=endpoint-channelData; apr_status_t ret; apr_interval_time_t timeout = 2 * APR_USEC_PER_SEC; char msg[128]; @@ -270,13 +263,7 @@ */ /* store the channel information */ -if( sd==NULL ) { -sd=(jk_channel_apr_data_t *) -endpoint-pool-calloc( env, endpoint-pool, -sizeof( jk_channel_apr_data_t )); -endpoint-channelData=sd; -} -sd-sock = sock; +endpoint-channelData=sock; return JK_OK; } @@ -290,12 +277,13 @@ apr_socket_t *sd; apr_status_t rc; -jk_channel_apr_data_t *chD=endpoint-channelData; -if( chD==NULL ) +sd=endpoint-channelData; +if( sd==NULL ) return JK_ERR; -sd=chD-sock; -chD-sock=NULL; /* XXX check it. */ +endpoint-channelData=NULL; /* XXX check it. */ +endpoint-sd=-1; + /* nothing else to clean, the socket_data was allocated ouf of * endpoint's pool */ @@ -330,17 +318,15 @@ int this_time; int unixsock; -jk_channel_apr_data_t *chD=endpoint-channelData; +sock=endpoint-channelData; -if( chD==NULL ) +if( sock==NULL ) return JK_ERR; msg-end( env, msg ); len=msg-len; b=msg-buf; -sock=chD-sock; - length = (apr_size_t) len; stat = apr_send(sock, b, length); if (stat!= APR_SUCCESS) { @@ -366,8 +352,6 @@ jk_endpoint_t *endpoint, char *b, int len ) { -jk_channel_apr_data_t *chD=endpoint-channelData; - apr_socket_t *sock; apr_size_t length; apr_status_t stat; @@ -375,9 +359,11 @@ int sd; int rdlen; -if( chD==NULL ) +sock=endpoint-channelData; + +if( sock==NULL ) return JK_ERR; -sock=chD-sock; + rdlen = 0; length = (apr_size_t) len; 1.18 +4 -23 jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c Index: jk_channel_jni.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- jk_channel_jni.c 11 May 2002 00:02:53 - 1.17 +++ jk_channel_jni.c 15 May 2002 19:34:09 - 1.18 @@ -176,8 +176,8 @@ solution */ epData=(jk_ch_jni_ep_private_t *) -endpoint-pool-calloc( env,endpoint-pool, -sizeof( jk_ch_jni_ep_private_t )); +endpoint-mbean-pool-calloc( env,endpoint-mbean-pool, + sizeof( jk_ch_jni_ep_private_t )); endpoint-channelData=epData; /** XXX make it customizable */ @@ -250,8 +250,8 @@ /* XXX ajp buffer size. Don't know how to fragment or reallocate yet */ -epData-carray=(char *)endpoint-pool-calloc( env, endpoint-pool, - epData-arrayLen); +epData-carray=(char *)endpoint-mbean-pool-calloc( env, endpoint-mbean-pool, + epData-arrayLen); jniCh-writeMethod = (*jniEnv)-GetStaticMethodID(jniEnv, jniCh-jniBridge, @@ -469,24 +469,6 @@ if( worker-mbean-debug 0 ) env-l-jkLog(env, env-l, JK_LOG_INFO, service() attaching to vm\n); - -jniEnv=(JNIEnv *)endpoint-endpoint_private; -if(jniEnv==NULL) { /*! attached */ -/* Try to attach */ -if( we-vm == NULL ) { -
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
nacho 02/05/11 18:08:45 Modified:jk/native2/common jk_channel_apr_socket.c Log: * Reordered headers less warnings Revision ChangesPath 1.16 +5 -3 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- jk_channel_apr_socket.c 11 May 2002 00:02:00 - 1.15 +++ jk_channel_apr_socket.c 12 May 2002 01:08:45 - 1.16 @@ -62,7 +62,12 @@ * @author: Costin Manolache * @author: Jean-Frederic Clere [EMAIL PROTECTED] */ +#include apr_network_io.h +#include apr_errno.h +#include apr_general.h + +#include jk_global.h #include jk_map.h #include jk_env.h #include jk_channel.h @@ -71,9 +76,6 @@ #include string.h #include jk_registry.h -#include apr_network_io.h -#include apr_errno.h -#include apr_general.h #define DEFAULT_HOST 127.0.0.1 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
costin 02/05/10 17:02:00 Modified:jk/native2/common jk_channel_apr_socket.c Log: remove the unix socket code, clean up - now it's apr socket only. Revision ChangesPath 1.15 +44 -182 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- jk_channel_apr_socket.c 3 May 2002 22:12:17 - 1.14 +++ jk_channel_apr_socket.c 11 May 2002 00:02:00 - 1.15 @@ -56,17 +56,7 @@ * = */ /** - * Channel using 'plain' TCP sockets or UNIX sockets. - * Based on jk_sockbuf. It uses a an APR-based mechanism. - * The UNIX sockets are not yet in APR (the code has to been written). - * - * Properties: - * - host/filename - * - port - * - ndelay (Where the hell we set it?) - * - * This channel should 'live' as much as the workerenv. It is stateless. - * It allocates memory for endpoint private data ( using endpoint's pool ). + * Channel using APR sockets. * * @author: Gal Shachor [EMAIL PROTECTED] * @author: Costin Manolache @@ -87,18 +77,12 @@ #define DEFAULT_HOST 127.0.0.1 -#define TYPE_UNIX 1 /* to be move in APR. */ -#define TYPE_NET 2 /* to be move in APR. */ /** Information specific for the socket channel */ struct jk_channel_apr_private { int ndelay; apr_sockaddr_t *addr; -#ifdef HAVE_UNIXSOCKETS -struct sockaddr_un unix_addr; -#endif -int type; /* AF_INET or AF_UNIX */ char *host; short port; }; @@ -106,11 +90,7 @@ /** Informations for each connection */ typedef struct jk_channel_apr_data { -int type; /* AF_INET or AF_UNIX */ apr_socket_t *sock; -#ifdef HAVE_UNIXSOCKETS -int unixsock; -#endif } jk_channel_apr_data_t; typedef struct jk_channel_apr_private jk_channel_apr_private_t; @@ -144,9 +124,6 @@ socketInfo-host=value; } else if( strcmp( port, name ) == 0 ) { socketInfo-port=atoi( value ); -} else if( strcmp( file, name ) == 0 ) { -socketInfo-host=value; -socketInfo-type=AF_UNIX; } else { if( ch-worker!=NULL ) { return ch-worker-mbean-setAttribute( env, ch-worker-mbean, name, valueP ); @@ -159,28 +136,33 @@ /** resolve the host IP ( jk_resolve ) and initialize the channel. */ static int JK_METHOD jk2_channel_apr_init(jk_env_t *env, - jk_channel_t *_this) + jk_channel_t *ch) { jk_channel_apr_private_t *socketInfo= -(jk_channel_apr_private_t *)(_this-_privatePtr); +(jk_channel_apr_private_t *)(ch-_privatePtr); int rc; short port=socketInfo-port; if( socketInfo-host==NULL ) { -char *localName=_this-mbean-localName; -jk_config_t *cfg=_this-workerEnv-config; +char *localName=ch-mbean-localName; +jk_config_t *cfg=ch-workerEnv-config; -/* Set the 'name' property - */ -localName = jk2_config_replaceProperties(env, cfg-map, cfg-map-pool, localName); +char *portIdx=strchr( localName, ':' ); -/* env-l-jkLog(env, env-l, JK_LOG_INFO, */ -/* channelApr.init(): use name %s\n, localName ); */ - -if (localName[0]=='/') { -_this-mbean-setAttribute( env, _this-mbean, file, localName ); +if( portIdx==NULL || portIdx[1]=='\0' ) { +socketInfo-port=8009; } else { -_this-mbean-setAttribute( env, _this-mbean, host, localName ); +portIdx++; +socketInfo-port=atoi( portIdx ); +} + +if( socketInfo-host==NULL ) { +socketInfo-host=ch-mbean-pool-calloc( env, ch-mbean-pool, strlen( localName ) + 1 ); +if( portIdx==NULL ) { +strcpy( socketInfo-host, localName ); +} else { +strncpy( socketInfo-host, localName, portIdx-localName-1 ); +} } } @@ -205,34 +187,14 @@ char *host, short port, jk_channel_apr_private_t *rc) { -/* - * If the hostname is an absolut path, we want a UNIX socket. - * otherwise it is a TCP/IP socket. - */ -/*env-l-jkLog(env, env-l, JK_LOG_ERROR, */ -/* jk2_channel_apr_resolve: %s %d\n, */ -/*
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_channel_socket.c
costin 02/05/03 10:39:40 Modified:jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_channel_socket.c Log: Call the setter on the worker for non-specific properties. Each channel is associated with an ajp worker ( later we can configure that, but at this moment we use ajp13 as the main protocol ). The load balancing parameters are set in the worker ( again, it's 1-1 relation between worker and channel, the worker is just a protocol with an associated channel ). Revision ChangesPath 1.11 +7 -7 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- jk_channel_apr_socket.c 30 Apr 2002 06:49:45 - 1.10 +++ jk_channel_apr_socket.c 3 May 2002 17:39:40 - 1.11 @@ -135,10 +135,10 @@ jk_bean_t *mbean, char *name, void *valueP) { -jk_channel_t *_this=(jk_channel_t *)mbean-object; +jk_channel_t *ch=(jk_channel_t *)mbean-object; char *value=valueP; jk_channel_apr_private_t *socketInfo= -(jk_channel_apr_private_t *)(_this-_privatePtr); +(jk_channel_apr_private_t *)(ch-_privatePtr); if( strcmp( host, name ) == 0 ) { socketInfo-host=value; @@ -148,6 +148,9 @@ socketInfo-host=value; socketInfo-type=AF_UNIX; } else { + if( ch-worker!=NULL ) { +return ch-worker-mbean-setAttribute( env, ch-worker-mbean, name, valueP ); +} return JK_ERR; } return JK_OK; @@ -258,9 +261,6 @@ int unixsock; -env-l-jkLog(env, env-l, JK_LOG_ERROR, - channelApr.open(): can't create socket \n); - /* UNIX socket (to be moved in APR) */ if (socketInfo-type==TYPE_UNIX) { unixsock = socket(AF_UNIX, SOCK_STREAM, 0); @@ -415,8 +415,6 @@ jk_channel_apr_data_t *chD=endpoint-channelData; -env-l-jkLog(env, env-l, JK_LOG_ERROR, - jk2_channel_apr_send %p\n, chD); if( chD==NULL ) return JK_ERR; @@ -446,6 +444,8 @@ while(sent len) { this_time = send(unixsock, (char *)b + sent , len - sent, 0); +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channel.apr:send() send() %d %d\n, this_time, errno); if(0 == this_time) { return -2; } 1.14 +14 -2 jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c Index: jk_channel_jni.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- jk_channel_jni.c 2 May 2002 03:13:05 - 1.13 +++ jk_channel_jni.c 3 May 2002 17:39:40 - 1.14 @@ -102,15 +102,27 @@ static int JK_METHOD jk2_channel_jni_setProperty(jk_env_t *env, jk_bean_t *mbean, - char *name, void *value) + char *name, void *valueP) { +jk_channel_t *ch=(jk_channel_t *)mbean-object; +char *value=valueP; + +if( ch-worker!=NULL ) { +return ch-worker-mbean-setAttribute( env, ch-worker-mbean, name, valueP ); +} return JK_OK; } static int JK_METHOD jk2_channel_jni_init(jk_env_t *env, - jk_channel_t *_this) + jk_channel_t *jniW) { +jk_workerEnv_t *wEnv=jniW-workerEnv; +if( wEnv-vm == NULL ) { +env-l-jkLog(env, env-l, JK_LOG_INFO, + channel_jni.init() no VM found\n ); +return JK_ERR; +} return JK_OK; } 1.21 +4 -1 jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c Index: jk_channel_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- jk_channel_socket.c 25 Apr 2002 18:49:37 - 1.20 +++ jk_channel_socket.c 3 May 2002 17:39:40 - 1.21 @@ -131,7 +131,10 @@ } else if( strcmp( port, name ) == 0 ) { socketInfo-port=atoi( value ); } else { - return JK_ERR; + if( ch-worker!=NULL ) {
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_worker_lb.c jk_worker_status.c
costin 02/05/03 11:10:58 Modified:jk/native2/common jk_channel_apr_socket.c jk_worker_lb.c jk_worker_status.c Log: Few fixes. Check errno after using unix socket Revision ChangesPath 1.12 +9 -2 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- jk_channel_apr_socket.c 3 May 2002 17:39:40 - 1.11 +++ jk_channel_apr_socket.c 3 May 2002 18:10:58 - 1.12 @@ -444,8 +444,15 @@ while(sent len) { this_time = send(unixsock, (char *)b + sent , len - sent, 0); -env-l-jkLog(env, env-l, JK_LOG_ERROR, - channel.apr:send() send() %d %d\n, this_time, errno); +env-l-jkLog(env, env-l, JK_LOG_INFO, + channel.apr:send() send() %d %d %s\n, this_time, errno, + strerror( errno)); +if( errno != 0 ) { +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channel.apr:send() send() %d %d %s\n, this_time, errno, + strerror( errno)); +return -2; +} if(0 == this_time) { return -2; } 1.6 +2 -1 jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c Index: jk_worker_lb.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jk_worker_lb.c3 May 2002 17:49:04 - 1.5 +++ jk_worker_lb.c3 May 2002 18:10:58 - 1.6 @@ -60,7 +60,7 @@ * several workers. * * Author: Gal Shachor [EMAIL PROTECTED] * * Based on: * - * Version: $Revision: 1.5 $ * + * Version: $Revision: 1.6 $ * ***/ #include jk_pool.h @@ -361,6 +361,7 @@ rec-in_recovering = JK_FALSE; rec-retry_count= 0; rec-error_time = 0; +rc-errCnt++; /* the endpoint that succeeded is saved for done() */ s-realWorker = rec; return JK_OK; 1.17 +1 -1 jakarta-tomcat-connectors/jk/native2/common/jk_worker_status.c Index: jk_worker_status.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_status.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- jk_worker_status.c3 May 2002 17:37:35 - 1.16 +++ jk_worker_status.c3 May 2002 18:10:58 - 1.17 @@ -138,7 +138,7 @@ s-jkprintf(env, s, /trtrtd%s/td\n, mbean-localName); for( j=0; mbean-getAttributeInfo[j] != NULL; j++ ) { char *pname=mbean-getAttributeInfo[j]; - + s-jkprintf(env, s, td%s/td, mbean-getAttribute( env, mbean, pname)); } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_endpoint.c jk_msg_ajp.c jk_requtil.c jk_workerEnv.c jk_worker_ajp13.c jk_worker_lb.c
costin 02/05/03 15:12:18 Modified:jk/native2/common jk_channel_apr_socket.c jk_endpoint.c jk_msg_ajp.c jk_requtil.c jk_workerEnv.c jk_worker_ajp13.c jk_worker_lb.c Log: Few more lb changes. This is getting a bit more agressive in trying to recover failed workers and simplifies the logic that is used. I tested it and seems to work very well with 'lbfactor=0' - if the default tomcat goes down, the request goes to the backup, when the default tomcat goes up ( after the timeout ) it'll be tried again. As soon as shm is finished, the default will go up when it re-register itself in the shm. Revision ChangesPath 1.14 +4 -5 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- jk_channel_apr_socket.c 3 May 2002 18:44:03 - 1.13 +++ jk_channel_apr_socket.c 3 May 2002 22:12:17 - 1.14 @@ -426,8 +426,6 @@ #ifdef HAVE_UNIXSOCKETS unixsock=chD-unixsock; #endif -env-l-jkLog(env, env-l, JK_LOG_ERROR, - jk2_channel_apr_send %d\n,chD-type); if (chD-type==TYPE_NET) { length = (apr_size_t) len; @@ -443,10 +441,11 @@ #ifdef HAVE_UNIXSOCKETS while(sent len) { /* this_time = send(unixsock, (char *)b + sent , len - sent, 0); */ +errno=0; this_time = write(unixsock, (char *)b + sent , len - sent); env-l-jkLog(env, env-l, JK_LOG_INFO, - channel.apr:send() send() %d %d %s\n, this_time, errno, + channel.apr:send() write() %d %d %s\n, this_time, errno, strerror( errno)); /* if( errno != 0 ) { */ /* env-l-jkLog(env, env-l, JK_LOG_ERROR, */ @@ -551,7 +550,7 @@ blen=msg-checkHeader( env, msg, endpoint ); if( blen 0 ) { env-l-jkLog(env, env-l, JK_LOG_ERROR, - channelAprArp.receive(): Bad header\n ); + channelApr.receive(): Bad header\n ); return JK_ERR; } @@ -559,7 +558,7 @@ if(rc 0) { env-l-jkLog(env, env-l, JK_LOG_ERROR, - channelAprApr.receive(): Error receiving message body %d %d\n, + channelApr.receive(): Error receiving message body %d %d\n, rc, errno); return JK_ERR; } 1.9 +14 -1 jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c Index: jk_endpoint.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_endpoint.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- jk_endpoint.c 25 Apr 2002 18:50:22 - 1.8 +++ jk_endpoint.c 3 May 2002 22:12:17 - 1.9 @@ -73,6 +73,8 @@ #include jk_objCache.h #include jk_registry.h +static char *myAttInfo[]={ channel, active, NULL }; + /** Will return endpoint specific runtime properties * *uri The uri that is beeing processed, NULL if the endpoing is inactive @@ -83,6 +85,16 @@ * */ static void * JK_METHOD jk2_endpoint_getAttribute(jk_env_t *env, jk_bean_t *bean, char *name ) { +jk_endpoint_t *ep=(jk_endpoint_t *)bean-object; + +if( strcmp( name, channel )==0 ) { +return ep-worker-channel-mbean-name; +} else if (strcmp( name, active )==0 ) { +if( ep-currentRequest != NULL ) +return ep-currentRequest-req_uri; +} else { +return NULL; +} return NULL; } @@ -107,7 +119,8 @@ e-request = jk2_msg_ajp_create( env, e-pool, 0); e-reply = jk2_msg_ajp_create( env, e-pool, 0); e-post = jk2_msg_ajp_create( env, e-pool, 0); - +result-getAttributeInfo=myAttInfo; +result-getAttribute= jk2_endpoint_getAttribute; e-reuse = JK_FALSE; e-cPool=endpointPool-create(env, endpointPool, HUGE_POOL_SIZE ); 1.10 +2 -1 jakarta-tomcat-connectors/jk/native2/common/jk_msg_ajp.c Index: jk_msg_ajp.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_msg_ajp.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- jk_msg_ajp.c 3 May 2002 17:41:52 - 1.9 +++ jk_msg_ajp.c 3 May 2002 22:12:17 - 1.10 @@ -60,7 +60,7 @@ * Author: Costin Manolache * Author: Gal Shachor [EMAIL PROTECTED] * *
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_env.c
costin 02/04/29 23:49:45 Modified:jk/native2/common jk_channel_apr_socket.c jk_env.c Log: Other minor fixes. Revision ChangesPath 1.10 +1 -1 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- jk_channel_apr_socket.c 25 Apr 2002 18:46:38 - 1.9 +++ jk_channel_apr_socket.c 30 Apr 2002 06:49:45 - 1.10 @@ -365,7 +365,7 @@ jk_endpoint_t *endpoint) { apr_socket_t *sd; -apr_status_t *rc; +apr_status_t rc; jk_channel_apr_data_t *chD=endpoint-channelData; if( chD==NULL ) 1.20 +8 -3 jakarta-tomcat-connectors/jk/native2/common/jk_env.c Index: jk_env.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_env.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- jk_env.c 25 Apr 2002 19:12:57 - 1.19 +++ jk_env.c 30 Apr 2002 06:49:45 - 1.20 @@ -167,10 +167,15 @@ char *type, char *localName ) { jk_env_objectFactory_t fac; -jk_bean_t *result; +jk_bean_t *result=NULL; jk_pool_t *workerPool; char *name; +if( localName!=NULL ) +result=env-getBean2( env, type, localName ); +if( result!=NULL ) +return result; + if( pool==NULL ) { pool=env-globalPool; } @@ -307,7 +312,7 @@ { if( name==NULL ) { env-l-jkLog(env, env-l, JK_LOG_ERROR, -env.getByName(): NullPointerException\n); +env.getBean(): NullPointerException\n); return NULL; } @@ -319,7 +324,7 @@ char *name; if( type==NULL || localName==NULL ) { env-l-jkLog(env, env-l, JK_LOG_ERROR, -env.getByName(): NullPointerException\n); +env.getBean2(): NullPointerException\n); return NULL; } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
costin 02/04/25 11:46:38 Modified:jk/native2/common jk_channel_apr_socket.c Log: Change return types and error handling Revision ChangesPath 1.9 +35 -27 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- jk_channel_apr_socket.c 20 Apr 2002 22:53:43 - 1.8 +++ jk_channel_apr_socket.c 25 Apr 2002 18:46:38 - 1.9 @@ -148,9 +148,9 @@ socketInfo-host=value; socketInfo-type=AF_UNIX; } else { -return JK_FALSE; +return JK_ERR; } -return JK_TRUE; +return JK_OK; } /** resolve the host IP ( jk_resolve ) and initialize the channel. @@ -188,7 +188,7 @@ socketInfo-host=DEFAULT_HOST; rc=jk2_channel_apr_resolve( env, socketInfo-host, socketInfo-port, socketInfo ); -if( rc!= JK_TRUE ) { +if( rc!= JK_OK ) { env-l-jkLog(env, env-l, JK_LOG_ERROR, jk2_channel_apr_init: can't resolve %s:%d errno=%d\n, socketInfo-host, socketInfo-port, errno ); } @@ -220,15 +220,18 @@ } else #endif { +int err; + rc-type = TYPE_NET; env-l-jkLog(env, env-l, JK_LOG_INFO, channelApr.resolve(): create AF_NET %s %d\n, host, port ); -if ( apr_sockaddr_info_get(rc-addr, host, APR_UNSPEC, port, 0, -(apr_pool_t *)env-globalPool-_private)!=APR_SUCCESS) { -return JK_FALSE; +err=apr_sockaddr_info_get(rc-addr, host, APR_UNSPEC, port, 0, + (apr_pool_t *)env-globalPool-_private); +if ( err != APR_SUCCESS) { +return err; } } -return JK_TRUE; +return JK_OK; } @@ -255,6 +258,9 @@ int unixsock; +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channelApr.open(): can't create socket \n); + /* UNIX socket (to be moved in APR) */ if (socketInfo-type==TYPE_UNIX) { unixsock = socket(AF_UNIX, SOCK_STREAM, 0); @@ -262,7 +268,7 @@ env-l-jkLog(env, env-l, JK_LOG_ERROR, channelApr.open(): can't create socket %d %s\n, errno, strerror( errno ) ); -return JK_FALSE; +return JK_ERR; } env-l-jkLog(env, env-l, JK_LOG_INFO, channelApr.open(): create unix socket %s %d\n, socketInfo-host, unixsock ); @@ -272,7 +278,7 @@ env-l-jkLog(env, env-l, JK_LOG_ERROR, channelApr.connect() connect failed %d %s\n, errno, strerror( errno ) ); -return JK_FALSE; +return JK_ERR; } env-l-jkLog(env, env-l, JK_LOG_INFO, channelApr.open(): connect unix socket %d %s\n, unixsock, socketInfo-host ); @@ -286,7 +292,7 @@ sd-unixsock = unixsock; sd-type = socketInfo-type; -return JK_TRUE; +return JK_OK; } #endif @@ -297,7 +303,7 @@ env-l-jkLog(env, env-l, JK_LOG_ERROR, channelApr.open(): can't create socket %d %s\n, errno, strerror( errno ) ); -return JK_FALSE; +return JK_ERR; } env-l-jkLog(env, env-l, JK_LOG_INFO, channelApr.open(): create tcp socket %d\n, sock ); @@ -306,7 +312,7 @@ env-l-jkLog(env, env-l, JK_LOG_ERROR, channelApr.open(): can't set timeout %d %s\n, errno, strerror( errno ) ); -return JK_FALSE; +return JK_ERR; } /* Tries to connect to JServ (continues trying while error is EINTR) */ @@ -326,7 +332,7 @@ env-l-jkLog(env, env-l, JK_LOG_ERROR, channelApr.connect() connect failed %d %s\n, ret, apr_strerror( ret, msg, sizeof(msg) ) ); -return JK_FALSE; +return JK_ERR; } /* XXX needed? @@ -349,7 +355,7 @@ sd-sock = sock; sd-type = socketInfo-type; /* APR should handle it. */ -return JK_TRUE; +return JK_OK; } @@ -359,9 +365,11 @@ jk_endpoint_t *endpoint) { apr_socket_t *sd; +apr_status_t *rc; + jk_channel_apr_data_t *chD=endpoint-channelData; if( chD==NULL ) -return JK_FALSE; +return JK_ERR; #ifdef HAVE_UNIXSOCKETS if (chD-type==TYPE_UNIX) { @@ -374,10 +382,8 @@ /* nothing else
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
nacho 02/04/20 15:53:43 Modified:jk/native2/common jk_channel_apr_socket.c Log: * Fxing some Unix sockets code without ifdef Revision ChangesPath 1.8 +2 -1 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- jk_channel_apr_socket.c 12 Apr 2002 22:53:56 - 1.7 +++ jk_channel_apr_socket.c 20 Apr 2002 22:53:43 - 1.8 @@ -434,7 +434,7 @@ } return JK_TRUE; } - +#ifdef HAVE_UNIXSOCKETS while(sent len) { this_time = send(unixsock, (char *)b + sent , len - sent, 0); @@ -448,6 +448,7 @@ } /* return sent; */ return JK_TRUE; +#endif } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_shm.c
nacho 02/04/12 15:53:56 Modified:jk/native2 build.xml jk/native2/common jk_channel_apr_socket.c jk_shm.c Log: Fixes for Win32 compatibility Revision ChangesPath 1.21 +26 -4 jakarta-tomcat-connectors/jk/native2/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- build.xml 11 Apr 2002 05:20:48 - 1.20 +++ build.xml 12 Apr 2002 22:53:56 - 1.21 @@ -76,6 +76,7 @@ target name=apache20 depends=init if=apache2.detect property name=apr.include location=${apache2.home}/include / +echo message=${apr.include}/ mkdir dir=${build.dir}/apache2 / so sofile=mod_jk2 buildDir=${build.dir}/apache2 @@ -88,30 +89,52 @@ info=Read/Write buffer size / def name=USE_APACHE_MD5 info=Use the MD5 implementation that is part of apache2 / - def name=HAS_APR + def name=HAS_APR info=Allow APR specific extensions / def name=HAVE_JNI info=Jni worker / def name=HPUX11 if=hpux / - src dir=. + def name=WIN32 if=win32 / + def name=NDEBUG if=win32 / + def name=_WINDOWS if=win32 / + def name=_MBCS if=win32 / + def name=_USRDLL if=win32 / + def name=MOD_JK2_EXPORTS if=win32 / + src dir=. include name=server/apache2/*.c / include name=common/*.c / include name=common/apr/*.c / - include name=jni/*.c / + include name=jni/*.c unless=win32/ + !-- exclude name=common/jk_channel_apr_socket.c if=win32/ -- /src includes include name=${native.dir}/common / include name=${apache2.include} / include name=${apr.include} / + include name=${apr-util.include} / include name=${native.dir}/include / include name=${java.home}/../include / include name=${java.home}/../include/linux if=linux / include name=${java.home}/../include/hp-ux if=hpux / +include name=${java.home}/../include/win32 if=win32 / /includes depends fileset dir=${native.dir}/common includes=*.h / fileset dir=${native.dir}/include includes=*.h / /depends + import fileName=libhttpd.lib if=win32 / + import fileName=libapr.lib if=win32 / + import fileName=libaprutil.lib if=win32 / + import fileName=wsock32.lib if=win32 / + import fileName=kernel32.lib if=win32 / + import fileName=user32.lib if=win32 / + import fileName=gdi32.lib if=win32 / + import fileName=winspool.lib if=win32 / + import fileName=comdlg32.lib if=win32 / + linkOpt value=/libpath:quot;${build.compiler.base}/libquot; if=win32 / + linkOpt value=/libpath:quot;${apr.lib}quot; if=win32 / + linkOpt value=/libpath:quot;${apr-util.lib}quot; if=win32 / + linkOpt value=/libpath:quot;${apache2.lib}quot; if=win32 / /so /target @@ -180,7 +203,6 @@ include name=${java.home}/../include/netware if=netware / include name=${java.home}/../include/win32 if=win32 / -include name=${java.home}/../include/linux if=linux / include name=${java.home}/../include/linux if=linux / /includes depends 1.7 +18 -6 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- jk_channel_apr_socket.c 11 Apr 2002 19:29:40 - 1.6 +++ jk_channel_apr_socket.c 12 Apr 2002 22:53:56 - 1.7 @@ -95,7 +95,9 @@ struct jk_channel_apr_private { int ndelay; apr_sockaddr_t *addr; +#ifdef HAVE_UNIXSOCKETS struct sockaddr_un unix_addr; +#endif int type; /* AF_INET or AF_UNIX */ char *host; short port; @@ -106,7 +108,9 @@ typedef struct jk_channel_apr_data { int type; /* AF_INET or AF_UNIX */ apr_socket_t *sock; +#ifdef HAVE_UNIXSOCKETS int unixsock; +#endif } jk_channel_apr_data_t; typedef struct jk_channel_apr_private jk_channel_apr_private_t; @@ -205,6 +209,7 @@ /*env-l-jkLog(env, env-l, JK_LOG_ERROR, */ /* jk2_channel_apr_resolve: %s %d\n, */ /* host, port); */ +#ifdef HAVE_UNIXSOCKETS if (host[0]=='/') { rc-type = TYPE_UNIX; memset(rc-unix_addr, 0, sizeof(struct sockaddr_un)); @@ -212,7 +217,9 @@
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
costin 02/04/11 12:29:40 Modified:jk/native2/common jk_channel_apr_socket.c Log: Few fixes and better initialization. Similar with channel_socket. Revision ChangesPath 1.6 +33 -25 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jk_channel_apr_socket.c 11 Apr 2002 05:44:46 - 1.5 +++ jk_channel_apr_socket.c 11 Apr 2002 19:29:40 - 1.6 @@ -152,7 +152,7 @@ /** resolve the host IP ( jk_resolve ) and initialize the channel. */ static int JK_METHOD jk2_channel_apr_init(jk_env_t *env, - jk_channel_t *_this) + jk_channel_t *_this) { jk_channel_apr_private_t *socketInfo= (jk_channel_apr_private_t *)(_this-_privatePtr); @@ -161,8 +161,14 @@ if( socketInfo-host==NULL ) { char *localName=_this-mbean-localName; -env-l-jkLog(env, env-l, JK_LOG_INFO, - channelApr.init(): use name %s\n, localName ); +jk_config_t *cfg=_this-workerEnv-config; + +/* Set the 'name' property + */ +localName = jk2_config_replaceProperties(env, cfg-map, cfg-map-pool, localName); + +/* env-l-jkLog(env, env-l, JK_LOG_INFO, */ +/* channelApr.init(): use name %s\n, localName ); */ if (localName[0]=='/') { _this-mbean-setAttribute( env, _this-mbean, file, localName ); @@ -182,9 +188,6 @@ env-l-jkLog(env, env-l, JK_LOG_ERROR, jk2_channel_apr_init: can't resolve %s:%d errno=%d\n, socketInfo-host, socketInfo-port, errno ); } -env-l-jkLog(env, env-l, JK_LOG_INFO, - channel_apr.init(): %s:%d for %s\n, socketInfo-host, - socketInfo-port, _this-worker-mbean-name ); return rc; } @@ -192,25 +195,27 @@ /** private: resolve the address on init */ static int JK_METHOD jk2_channel_apr_resolve(jk_env_t *env, - char *host, short port, - jk_channel_apr_private_t *rc) + char *host, short port, + jk_channel_apr_private_t *rc) { /* * If the hostname is an absolut path, we want a UNIX socket. * otherwise it is a TCP/IP socket. */ -env-l-jkLog(env, env-l, JK_LOG_ERROR, - jk2_channel_apr_resolve: %s %d\n, - host, port); +/*env-l-jkLog(env, env-l, JK_LOG_ERROR, */ +/* jk2_channel_apr_resolve: %s %d\n, */ +/* host, port); */ if (host[0]=='/') { rc-type = TYPE_UNIX; memset(rc-unix_addr, 0, sizeof(struct sockaddr_un)); rc-unix_addr.sun_family = AF_UNIX; strcpy(rc-unix_addr.sun_path, host); env-l-jkLog(env, env-l, JK_LOG_INFO, - channelApr.resolve(): create unix_addr %s\n, host ); + channelApr.resolve(): create AF_UNIX %s\n, host ); } else { rc-type = TYPE_NET; +env-l-jkLog(env, env-l, JK_LOG_INFO, + channelApr.resolve(): create AF_NET %s %d\n, host, port ); if ( apr_sockaddr_info_get(rc-addr, host, APR_UNSPEC, port, 0, (apr_pool_t *)env-globalPool-_private)!=APR_SUCCESS) { return JK_FALSE; @@ -251,7 +256,7 @@ return JK_FALSE; } env-l-jkLog(env, env-l, JK_LOG_INFO, - channelApr.open(): create unix socket %d\n, unixsock ); + channelApr.open(): create unix socket %s %d\n, socketInfo-host, unixsock ); if (connect(unixsock,(struct sockaddr *)(socketInfo-unix_addr), sizeof(struct sockaddr_un))0) { close(unixsock); @@ -543,23 +548,26 @@ jk_bean_t *result, const char *type, const char *name) { -jk_channel_t *_this; +jk_channel_t *ch; -_this=(jk_channel_t *)pool-calloc(env, pool, sizeof( jk_channel_t)); +ch=(jk_channel_t *)pool-calloc(env, pool, sizeof( jk_channel_t)); -_this-_privatePtr= (jk_channel_apr_private_t *) +ch-_privatePtr= (jk_channel_apr_private_t *) pool-calloc( env, pool, sizeof( jk_channel_apr_private_t)); -_this-recv= jk2_channel_apr_recv; -
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c
costin 02/04/10 22:44:46 Modified:jk/native2/common jk_channel_apr_socket.c Log: Got unix socket to work again. Note that we still use 'direct' unix calls, not the APR wrappers ( is it finished ? I read about adding it in the plain apr sockets, but didn't see the code yet ). I also changed the names and messages to show the real source ( the code was cutpasted from channel_socket ). Support the same 'trick' of using the object name as the constructor/URL. All you need is: [worker.ajp13:apr] channel=channel.apr:${jkHome}/work/jk2.socket Revision ChangesPath 1.5 +88 -65 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- jk_channel_apr_socket.c 18 Mar 2002 18:25:05 - 1.4 +++ jk_channel_apr_socket.c 11 Apr 2002 05:44:46 - 1.5 @@ -92,7 +92,7 @@ /** Information specific for the socket channel */ -struct jk_channel_socket_private { +struct jk_channel_apr_private { int ndelay; apr_sockaddr_t *addr; struct sockaddr_un unix_addr; @@ -103,43 +103,46 @@ /** Informations for each connection */ -typedef struct jk_channel_socket_data { +typedef struct jk_channel_apr_data { int type; /* AF_INET or AF_UNIX */ apr_socket_t *sock; int unixsock; -} jk_channel_socket_data_t; +} jk_channel_apr_data_t; -typedef struct jk_channel_socket_private jk_channel_socket_private_t; +typedef struct jk_channel_apr_private jk_channel_apr_private_t; /* We use the _privateInt field directly. Long term we can define our own - jk_channel_socket_t structure and use the _private field, etc - but we + jk_channel_apr_t structure and use the _private field, etc - but we just need to store an int. XXX We could also use properties or 'notes' */ -static int JK_METHOD jk2_channel_socket_resolve(jk_env_t *env, char *host, +static int JK_METHOD jk2_channel_apr_resolve(jk_env_t *env, char *host, short port, -jk_channel_socket_private_t *rc); +jk_channel_apr_private_t *rc); -static int JK_METHOD jk2_channel_socket_close(jk_env_t *env, jk_channel_t *_this, +static int JK_METHOD jk2_channel_apr_close(jk_env_t *env, jk_channel_t *_this, jk_endpoint_t *endpoint); -static int JK_METHOD jk2_channel_socket_setProperty(jk_env_t *env, +static int JK_METHOD jk2_channel_apr_setProperty(jk_env_t *env, jk_bean_t *mbean, char *name, void *valueP) { jk_channel_t *_this=(jk_channel_t *)mbean-object; char *value=valueP; -jk_channel_socket_private_t *socketInfo= -(jk_channel_socket_private_t *)(_this-_privatePtr); +jk_channel_apr_private_t *socketInfo= +(jk_channel_apr_private_t *)(_this-_privatePtr); if( strcmp( host, name ) == 0 ) { socketInfo-host=value; } else if( strcmp( port, name ) == 0 ) { socketInfo-port=atoi( value ); +} else if( strcmp( file, name ) == 0 ) { +socketInfo-host=value; +socketInfo-type=AF_UNIX; } else { return JK_FALSE; } @@ -148,51 +151,64 @@ /** resolve the host IP ( jk_resolve ) and initialize the channel. */ -static int JK_METHOD jk2_channel_socket_init(jk_env_t *env, +static int JK_METHOD jk2_channel_apr_init(jk_env_t *env, jk_channel_t *_this) { -jk_channel_socket_private_t *socketInfo= -(jk_channel_socket_private_t *)(_this-_privatePtr); +jk_channel_apr_private_t *socketInfo= +(jk_channel_apr_private_t *)(_this-_privatePtr); int rc; -char *host=socketInfo-host; short port=socketInfo-port; + +if( socketInfo-host==NULL ) { +char *localName=_this-mbean-localName; +env-l-jkLog(env, env-l, JK_LOG_INFO, + channelApr.init(): use name %s\n, localName ); + +if (localName[0]=='/') { +_this-mbean-setAttribute( env, _this-mbean, file, localName ); +} else { +_this-mbean-setAttribute( env, _this-mbean, host, localName ); +} +} -if( port=0 ) -port=8007; +if( socketInfo-port=0 ) +socketInfo-port=8009; -if( host==NULL ) -host=DEFAULT_HOST; +if( socketInfo-host==NULL ) +
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_channel_socket.c
costin 02/03/18 10:25:05 Modified:jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_channel_socket.c Log: Update the config of channels. Revision ChangesPath 1.4 +12 -27 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_channel_apr_socket.c 2 Mar 2002 06:07:48 - 1.3 +++ jk_channel_apr_socket.c 18 Mar 2002 18:25:05 - 1.4 @@ -119,10 +119,6 @@ XXX We could also use properties or 'notes' */ -int JK_METHOD jk2_channel_socket_factory(jk_env_t *env, jk_pool_t *pool, - void **result, - const char *type, const char *name); - static int JK_METHOD jk2_channel_socket_resolve(jk_env_t *env, char *host, short port, jk_channel_socket_private_t *rc); @@ -130,17 +126,13 @@ static int JK_METHOD jk2_channel_socket_close(jk_env_t *env, jk_channel_t *_this, jk_endpoint_t *endpoint); -static int JK_METHOD jk2_channel_socket_getProperty(jk_env_t *env, -jk_channel_t *_this, -char *name, char **value) -{ -return JK_FALSE; -} static int JK_METHOD jk2_channel_socket_setProperty(jk_env_t *env, - jk_channel_t *_this, - char *name, char *value) +jk_bean_t *mbean, +char *name, void *valueP) { +jk_channel_t *_this=(jk_channel_t *)mbean-object; +char *value=valueP; jk_channel_socket_private_t *socketInfo= (jk_channel_socket_private_t *)(_this-_privatePtr); @@ -178,7 +170,7 @@ } env-l-jkLog(env, env-l, JK_LOG_INFO, channel_socket.init(): %s:%d for %s\n, host, - port, _this-worker-name ); + port, _this-worker-mbean-name ); return rc; } @@ -524,17 +516,12 @@ int JK_METHOD jk2_channel_apr_socket_factory(jk_env_t *env, -jk_pool_t *pool, -void **result, -const char *type, const char *name) + jk_pool_t *pool, + jk_bean_t *result, + const char *type, const char *name) { jk_channel_t *_this; -if( strcmp( channel, type ) != 0 ) { -/* Wrong type XXX throw */ -*result=NULL; -return JK_FALSE; -} _this=(jk_channel_t *)pool-calloc(env, pool, sizeof( jk_channel_t)); _this-_privatePtr= (jk_channel_socket_private_t *) @@ -545,13 +532,11 @@ _this-init= jk2_channel_socket_init; _this-open= jk2_channel_socket_open; _this-close= jk2_channel_socket_close; -/* _this-getProperty= jk2_channel_socket_getProperty; */ -_this-setProperty= jk2_channel_socket_setProperty; - -_this-name=aprSocket; - -*result= _this; _this-is_stream=JK_TRUE; + +result-setAttribute= jk2_channel_socket_setProperty; +_this-mbean=result; +result-object= _this; return JK_TRUE; } 1.5 +12 -23jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c Index: jk_channel_jni.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- jk_channel_jni.c 2 Mar 2002 06:07:48 - 1.4 +++ jk_channel_jni.c 18 Mar 2002 18:25:05 - 1.5 @@ -99,14 +99,10 @@ } jk_ch_jni_ep_private_t; -int JK_METHOD jk2_channel_jni_factory(jk_env_t *env, jk_pool_t *pool, - void **result, - const char *type, const char *name); - static int JK_METHOD jk2_channel_jni_setProperty(jk_env_t *env, - jk_channel_t *_this, - char *name, char *value) + jk_bean_t *mbean, +
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_channel_socket.c
costin 02/03/01 22:07:48 Modified:jk/native2/common jk_channel_apr_socket.c jk_channel_jni.c jk_channel_socket.c Log: setProperty() style for configuration Revision ChangesPath 1.3 +14 -33 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_channel_apr_socket.c 21 Feb 2002 11:09:31 - 1.2 +++ jk_channel_apr_socket.c 2 Mar 2002 06:07:48 - 1.3 @@ -144,10 +144,10 @@ jk_channel_socket_private_t *socketInfo= (jk_channel_socket_private_t *)(_this-_privatePtr); -if( strcmp( host, name ) != 0 ) { +if( strcmp( host, name ) == 0 ) { socketInfo-host=value; -} else if( strcmp( defaultPort, name ) != 0 ) { -} else if( strcmp( port, name ) != 0 ) { +} else if( strcmp( port, name ) == 0 ) { +socketInfo-port=atoi( value ); } else { return JK_FALSE; } @@ -157,42 +157,30 @@ /** resolve the host IP ( jk_resolve ) and initialize the channel. */ static int JK_METHOD jk2_channel_socket_init(jk_env_t *env, -jk_channel_t *_this, -jk_map_t *props, -char *worker_name, -jk_worker_t *worker ) + jk_channel_t *_this) { -int err; jk_channel_socket_private_t *socketInfo= (jk_channel_socket_private_t *)(_this-_privatePtr); +int rc; char *host=socketInfo-host; short port=socketInfo-port; -jk_workerEnv_t *workerEnv=worker-workerEnv; -char *tmp; -host = jk2_map_getStrProp( env, props, - worker, worker_name, host, host); -tmp = jk2_map_getStrProp( env, props, - worker, worker_name, port, NULL ); -if( tmp != NULL ) -port=jk2_map_str2int( env, tmp); - -_this-worker=worker; -_this-properties=props; +if( port=0 ) +port=8007; if( host==NULL ) host=DEFAULT_HOST; - -err=jk2_channel_socket_resolve( env, host, port, socketInfo ); -if( err!= JK_TRUE ) { + +rc=jk2_channel_socket_resolve( env, host, port, socketInfo ); +if( rc!= JK_TRUE ) { env-l-jkLog(env, env-l, JK_LOG_ERROR, jk2_channel_socket_init: can't resolve %s:%d errno=%d\n, host, port, errno ); } env-l-jkLog(env, env-l, JK_LOG_INFO, channel_socket.init(): %s:%d for %s\n, host, - port, worker-name ); + port, _this-worker-name ); -return err; +return rc; } /** private: resolve the address on init @@ -557,17 +545,10 @@ _this-init= jk2_channel_socket_init; _this-open= jk2_channel_socket_open; _this-close= jk2_channel_socket_close; -_this-getProperty= jk2_channel_socket_getProperty; +/* _this-getProperty= jk2_channel_socket_getProperty; */ _this-setProperty= jk2_channel_socket_setProperty; -_this-supportedProperties=( char ** )pool-alloc( env, pool, - 4 * sizeof( char * )); -_this-supportedProperties[0]=host; -_this-supportedProperties[1]=port; -_this-supportedProperties[2]=defaultPort; -_this-supportedProperties[3]=\0; - -_this-name=file; +_this-name=aprSocket; *result= _this; _this-is_stream=JK_TRUE; 1.4 +13 -17jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c Index: jk_channel_jni.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_channel_jni.c 21 Feb 2002 11:09:31 - 1.3 +++ jk_channel_jni.c 2 Mar 2002 06:07:48 - 1.4 @@ -101,30 +101,25 @@ int JK_METHOD jk2_channel_jni_factory(jk_env_t *env, jk_pool_t *pool, void **result, - const char *type, const char *name); + const char *type, const char *name); -static int JK_METHOD jk2_channel_jni_init(jk_env_t *env, - jk_channel_t *_this, - jk_map_t *props, - char *worker_name,
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_channel_apr_socket.c jk_channel_socket.c
costin 02/01/25 23:05:19 Modified:jk/native2/common jk_channel_socket.c Added: jk/native2/common jk_channel_apr_socket.c Log: Update the channels. I moved the apr_socket in the same dir - apr is not a special case, it'll be the default. If jni is here, apr should be too - I would rather move the 'old' socket in a special dir ( or just remove it later ). Revision ChangesPath 1.12 +58 -6 jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c Index: jk_channel_socket.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- jk_channel_socket.c 17 Dec 2001 07:17:08 - 1.11 +++ jk_channel_socket.c 26 Jan 2002 07:05:19 - 1.12 @@ -165,7 +165,7 @@ host = jk_map_getStrProp( env, props, worker, worker_name, host, host); tmp = jk_map_getStrProp( env, props, - worker, worker_name, port, NULL ); + worker, worker_name, port, 8007 ); if( tmp != NULL ) port=jk_map_str2int( env, tmp); @@ -344,14 +344,20 @@ */ static int JK_METHOD jk_channel_socket_send(jk_env_t *env, jk_channel_t *_this, jk_endpoint_t *endpoint, -char *b, int len) +jk_msg_t *msg) { +char *b; +int len; int sd; int sent=0; - jk_channel_socket_data_t *chD=endpoint-channelData; + if( chD==NULL ) return JK_FALSE; + +msg-end( env, msg ); +len=msg-len; +b=msg-buf; sd=chD-sock; while(sent len) { @@ -378,9 +384,10 @@ *0: length of the received data. * Was: tcp_socket_recvfull */ -static int JK_METHOD jk_channel_socket_recv( jk_env_t *env, jk_channel_t *_this, - jk_endpoint_t *endpoint, - char *b, int len ) +static int JK_METHOD jk_channel_socket_readN( jk_env_t *env, + jk_channel_t *_this, + jk_endpoint_t *endpoint, + char *b, int len ) { jk_channel_socket_data_t *chD=endpoint-channelData; int sd; @@ -417,6 +424,49 @@ } +/** receive len bytes. + * @param sd opened socket. + * @param b buffer to store the data. + * @param len length to receive. + * @return-1: receive failed or connection closed. + *0: length of the received data. + * Was: tcp_socket_recvfull + */ +static int JK_METHOD jk_channel_socket_recv( jk_env_t *env, jk_channel_t *_this, + jk_endpoint_t *endpoint, + jk_msg_t *msg ) +{ +int hlen=msg-headerLength; +int blen; +int rc; + + +jk_channel_socket_readN( env, _this, endpoint, msg-buf, hlen ); + +blen=msg-checkHeader( env, msg, endpoint ); +if( blen 0 ) { +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channelSocket.receive(): Bad header\n ); +return JK_FALSE; +} + +rc= jk_channel_socket_readN( env, _this, endpoint, msg-buf + hlen, blen); + +if(rc 0) { +env-l-jkLog(env, env-l, JK_LOG_ERROR, + channelSocket.receive(): Error receiving message body %d %d\n, + rc, errno); +return JK_FALSE; +} + +env-l-jkLog(env, env-l, JK_LOG_INFO, + channelSocket.receive(): Received len=%d type=%d\n, + blen, (int)msg-buf[hlen]); +return JK_TRUE; + +} + + int JK_METHOD jk_channel_socket_factory(jk_env_t *env, jk_pool_t *pool, @@ -452,6 +502,8 @@ _this-name=file; +_this-is_stream=JK_TRUE; + *result= _this; return JK_TRUE; 1.1 jakarta-tomcat-connectors/jk/native2/common/jk_channel_apr_socket.c Index: jk_channel_apr_socket.c === /* = * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999-2001 The Apache Software Foundation. * * All rights reserved.