cvs commit: jakarta-tomcat-connectors/jk/native/common jk_connect.h
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_connect.h
mturk 2004/11/08 05:28:31 Modified:jk/native/common jk_connect.h Log: Add socket timout to open_socket Revision ChangesPath 1.10 +11 -8 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- jk_connect.h 8 Oct 2004 07:50:40 - 1.9 +++ jk_connect.h 8 Nov 2004 13:28:31 - 1.10 @@ -35,18 +35,21 @@ { #endif /* __cplusplus */ -int jk_resolve(char *host, int port, struct sockaddr_in *rc); +int jk_resolve(char *host, int port, struct sockaddr_in *rc); -int jk_open_socket(struct sockaddr_in *addr, - int ndelay, int keepalive, jk_logger_t *l); +int jk_open_socket(struct sockaddr_in *addr, int ndelay, + int keepalive, int timeout, jk_logger_t *l); -int jk_close_socket(int s); +int jk_close_socket(int s); -int jk_tcp_socket_sendfull(int sd, const unsigned char *b, int len); +int jk_tcp_socket_sendfull(int sd, const unsigned char *b, int len); -int jk_tcp_socket_recvfull(int sd, unsigned char *b, int len); +int jk_tcp_socket_recvfull(int sd, unsigned char *b, int len); + +char *jk_dump_hinfo(struct sockaddr_in *saddr, char *buf); + +int jk_socket_timeout_set(int sd, int timeout, int t); -char *jk_dump_hinfo(struct sockaddr_in *saddr, char *buf); #ifdef __cplusplus } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_connect.h
mmanders2004/05/25 15:32:55 Modified:jk/native/common jk_connect.h Log: Fixed define if building for NetWare and using LIBC (i.e. Apache2). Revision ChangesPath 1.8 +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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- jk_connect.h 1 Mar 2004 13:37:38 - 1.7 +++ jk_connect.h 25 May 2004 22:32:55 - 1.8 @@ -26,7 +26,7 @@ #include jk_logger.h #include jk_global.h -#ifndef WIN32 +#if !defined(WIN32) !(defined(NETWARE) defined(__NOVELL_LIBC__)) #define closesocket close #endif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_connect.h jk_ajp_common.c jk_connect.c
hgomez 2004/03/01 05:37:38 Modified:jk/native/common jk_connect.h jk_ajp_common.c jk_connect.c Log: Dump informations about remote tomcat in form : A.B.C.D:PORT Revision ChangesPath 1.7 +4 -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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- jk_connect.h 24 Feb 2004 08:45:47 - 1.6 +++ jk_connect.h 1 Mar 2004 13:37:38 - 1.7 @@ -53,6 +53,9 @@ unsigned char *b, int len); +char * jk_dump_hinfo(struct sockaddr_in *saddr, + char * buf); + #ifdef __cplusplus } #endif /* __cplusplus */ 1.54 +9 -7 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.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- jk_ajp_common.c 1 Mar 2004 11:21:03 - 1.53 +++ jk_ajp_common.c 1 Mar 2004 13:37:38 - 1.54 @@ -691,6 +691,7 @@ int ajp_connect_to_endpoint(ajp_endpoint_t *ae, jk_logger_t*l) { + char buf[32]; unsigned attempt; for(attempt = 0; attempt ae-worker-connect_retry_attempts; attempt++) { @@ -699,8 +700,8 @@ if(ae-sd = 0) { jk_log(l, JK_LOG_DEBUG, In jk_endpoint_t::ajp_connect_to_endpoint, - connected sd = %d, port = %d\n, - ae-sd, (int)ae-worker-worker_inet_addr.sin_port); + connected sd = %d to %s\n, + ae-sd, jk_dump_hinfo(ae-worker-worker_inet_addr, buf)); /* set last_access */ ae-last_access = time(NULL); @@ -718,8 +719,8 @@ jk_log(l, JK_LOG_INFO, Error connecting to tomcat. Tomcat is probably not started or is - listening on the wrong port (%d). Failed errno = %d\n, - (int)ae-worker-worker_inet_addr.sin_port, errno); + listening on the wrong host/port (%s). Failed errno = %d\n, + jk_dump_hinfo(ae-worker-worker_inet_addr, buf), errno); return JK_FALSE; } @@ -766,6 +767,7 @@ int rc; int msglen; unsigned int header; +char buf[32]; if ((ae-proto != AJP13_PROTO) (ae-proto != AJP14_PROTO)) { jk_log(l, JK_LOG_ERROR, @@ -780,8 +782,8 @@ if(rc 0) { jk_log(l, JK_LOG_ERROR, ERROR: can't receive the response message from tomcat, - network problems or tomcat is down. err=%d\n, - rc); + network problems or tomcat is down (%s), err=%d\n, + jk_dump_hinfo(ae-worker-worker_inet_addr, buf), rc); return JK_FALSE; } 1.18 +21 -3 jakarta-tomcat-connectors/jk/native/common/jk_connect.c Index: jk_connect.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- jk_connect.c 24 Feb 2004 08:45:48 - 1.17 +++ jk_connect.c 1 Mar 2004 13:37:38 - 1.18 @@ -128,6 +128,7 @@ int keepalive, jk_logger_t *l) { +char buf[32]; int sock; jk_log(l, JK_LOG_DEBUG, Into jk_open_socket\n); @@ -135,9 +136,11 @@ sock = socket(AF_INET, SOCK_STREAM, 0); if(sock -1) { int ret; -/* Tries to connect to JServ (continues trying while error is EINTR) */ +/* Tries to connect to Tomcat (continues trying while error is EINTR) */ do { -jk_log(l, JK_LOG_DEBUG, jk_open_socket, try to connect socket = %d\n, sock); +jk_log(l, JK_LOG_DEBUG, jk_open_socket, try to connect socket = %d to %s\n, + sock, jk_dump_hinfo(addr, buf)); + ret = connect(sock, (struct sockaddr *)addr, sizeof(struct sockaddr_in)); @@ -277,4 +280,19 @@ } return rdlen; +} + +/** + * dump a sockaddr_in in A.B.C.D:P in ASCII buffer + * + */ +char * jk_dump_hinfo(struct sockaddr_in *saddr, char * buf) +{ + in_addr_t laddr = htonl(saddr-sin_addr.s_addr); + in_port_t lport = htons(saddr-sin_port); + + sprintf(buf, %d.%d.%d.%d:%d, + (int)(laddr 24),
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_connect.h jk_ajp12_worker.c jk_ajp_common.c jk_connect.c
hgomez 2003/07/24 01:17:10 Modified:jk/native/common jk_connect.h jk_ajp12_worker.c jk_ajp_common.c jk_connect.c Log: Make use of APR gethostbyname equivalent when APR is available. Remove AS/400 specific code and fix some short to int in port. We'll use integer everywhere and cast to short only in jk_resolve Revision ChangesPath 1.4 +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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- jk_connect.h 25 Jun 2002 07:06:59 - 1.3 +++ jk_connect.h 24 Jul 2003 08:17:10 - 1.4 @@ -76,7 +76,7 @@ #endif /* __cplusplus */ int jk_resolve(char *host, - short port, + int port, struct sockaddr_in *rc); int jk_open_socket(struct sockaddr_in *addr, 1.11 +2 -2 jakarta-tomcat-connectors/jk/native/common/jk_ajp12_worker.c Index: jk_ajp12_worker.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp12_worker.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- jk_ajp12_worker.c 16 May 2003 00:36:18 - 1.10 +++ jk_ajp12_worker.c 24 Jul 2003 08:17:10 - 1.11 @@ -213,7 +213,7 @@ p-name, host, port); if(port 1024 host) { -if(jk_resolve(host, (short)port, p-worker_inet_addr)) { +if(jk_resolve(host, port, p-worker_inet_addr)) { return JK_TRUE; } jk_log(l, JK_LOG_ERROR, In jk_worker_t::validate, resolve failed\n); 1.38 +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.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- jk_ajp_common.c 15 Jul 2003 12:15:17 - 1.37 +++ jk_ajp_common.c 24 Jul 2003 08:17:10 - 1.38 @@ -1366,7 +1366,7 @@ p-name, host, port); if(port 1024 host) { -if(jk_resolve(host, (short)port, p-worker_inet_addr)) { +if(jk_resolve(host, port, p-worker_inet_addr)) { return JK_TRUE; } jk_log(l, JK_LOG_ERROR, 1.9 +39 -19jakarta-tomcat-connectors/jk/native/common/jk_connect.c Index: jk_connect.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- jk_connect.c 17 Feb 2003 16:59:47 - 1.8 +++ jk_connect.c 24 Jul 2003 08:17:10 - 1.9 @@ -95,18 +95,24 @@ #include novsock2.h #endif +#ifdef HAVE_APR +#include apr_network_io.h +#include apr_errno.h +#include apr_general.h +#endif + /** resolve the host IP */ int jk_resolve(char *host, - short port, + int port, struct sockaddr_in *rc) { int x; -u_long laddr; -#ifdef AS400 -memset(rc, 0, sizeof(struct sockaddr_in)); -#endif +/* TODO: Should be updated for IPV6 support. */ +/* for now use the correct type, in_addr_t */ +in_addr_t laddr; + rc-sin_port = htons((short)port); rc-sin_family = AF_INET; @@ -117,26 +123,40 @@ } } +/* If we found also characters we shoud make name to IP resolution */ if(host[x] != '\0') { -#ifdef AS400 - /* If we found also characters we use gethostbyname_r()*/ - struct hostent hostentry; - struct hostent *hoste = hostentry; - struct hostent_data hd; - memset( hd, 0, sizeof(struct hostent_data) ); - if ( (gethostbyname_r( host, hoste, hd )) != 0 ) { -return JK_FALSE; - } -#else /* If we found also characters we use gethostbyname()*/ - /* XXX : WARNING : We should really use gethostbyname_r in multi-threaded env */ - /* take a look at APR which handle gethostbyname in apr/network_io/unix/sa_common.c */ + +#ifdef HAVE_APR +apr_pool_t *context; +apr_sockaddr_t *remote_sa; +char *remote_ipaddr; + +/* May be we could avoid to recreate it each time ? */ +if (apr_pool_create(context, NULL) != APR_SUCCESS) +return JK_FALSE; + +if (apr_sockaddr_info_get(remote_sa, host, APR_UNSPEC,
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_connect.h
mturk 2002/06/25 00:06:59 Modified:jk/native/common jk_connect.h Log: Introduced socket and cache timeout. By Jan Singer, Henri Gomez and Mladen Turk. Revision ChangesPath 1.3 +3 -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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_connect.h 18 Jun 2001 14:15:36 - 1.2 +++ jk_connect.h 25 Jun 2002 07:06:59 - 1.3 @@ -68,7 +68,7 @@ #include jk_global.h #ifndef WIN32 - #define closesocket close +#define closesocket close #endif #ifdef __cplusplus @@ -81,6 +81,7 @@ int jk_open_socket(struct sockaddr_in *addr, int ndelay, + int keepalive, jk_logger_t *l); int jk_close_socket(int s); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]