Henri Gomez wrote:
> Guenter Knauf wrote:
>
>> Hi Henri,
>>
>>> hgomez@apache.org wrote:
>>
>>
>>
>>>> hgomez 2004/03/01 05:47:23
>>>>
>>>> Modified: jk/native/common jk_ajp_common.c
>>>> Log:
>>>> More debug/trace infos on remote tomcats
>>
>>
>>
>>> I added more infos on IP/PORT of remote tomcats in jk, since I've some
>>> reports that there is a problem for admins to determine which tomcat
>>> is down when they have many workers defined...
>>
>>
>>
>>> I overcome the inet_ntoa by using a jk_dump_hinfo function which should
>>> works also in multi-threaded env.
>>
>>
>>
>>> It should works on Unixes, but I'd like to have reports from
>>> Win32, Netware and others exotics OS users...
>>
>>
>> the change of ---
>> jakarta-tomcat-connectors/jk/native/common/jk_connect.c 2004/02/24
>> 08:45:48 1.17
>> +++ jakarta-tomcat-connectors/jk/native/common/jk_connect.c 2004/03/01
>> 13:37:38 1.18
>>
>> breaks all targets on NetWare: netscape, apache-1.3 and apache-2;
>> the problem is that in_addr_t and in_port_t are not defined.
>> Futhermore I consider in_addr_t as a dangerous var, google a bit and
>> you will see that some OSes define it as unsigned long (which is what
>> we need here) while others define it to a struct in_addr. NetWare also
>> defines it to the in_addr struct so that its useless here - and even
>> more ugly it would be if I had to include netinet/in.h for other
>> reasons, then I would have to undef at least in_addr_t.
>> So we should avoid these typedefs at all, and simply use ulong and
>> ushort.
>>
>> --- jk_connect.c.orig Mon Mar 15 16:04:08 2004
>> +++ jk_connect.c Mon Mar 15 18:16:28 2004
>> @@ -288,8 +288,8 @@
>> */
>> 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);
>> + unsigned long laddr = htonl(saddr->sin_addr.s_addr);
>> + unsigned short lport = htons(saddr->sin_port);
>>
>> sprintf(buf, "%d.%d.%d.%d:%d", (int)(laddr >> 24),
>> (int)((laddr >> 16) & 0xff), (int)((laddr >> 8) & 0xff), (int)(laddr
&
>> 0xff), (int)lport);
>>
>> I've not tested this yet, but at least I can now compile again. In
>> addtion our older clib has a strange behavior with these functions, so
>> there's certainly another additional patch needed for apache-1.3 and
>> netscape; apache-2 should work with the above.
>>
>> btw: we should really take care of tabs and avoid them - as outlined
>> in the ASF developer docs. Currently there are a couple of files which
>> contain tabs, they should be removed IMO.
>>
>> Guenter.
>
>
> From my Linux manpage we shoulld use uint32_t and uint16_t
> for htonl and htons.
Use that should prevent compilers beeing unhappy:
+++
unsigned long laddr = (unsigned long) htonl(saddr->sin_addr.s_addr);
unsigned short lport = (unsigned short) htons(saddr->sin_port);
+++
>
> What about Netware ?
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>
|