apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apr/test client.c server.c
Date Tue, 21 Nov 2000 20:08:27 GMT
On Tue, Nov 21, 2000 at 07:15:32PM -0000, trawick@locus.apache.org wrote:
> trawick     00/11/21 11:15:30
> 
>   Modified:    test     client.c server.c
>   Log:
>   updates to changed interfaces to apr_set_port(), apr_get_port(),
>   apr_set_ipaddr(), and apr_get_ipaddr()
>...
>   --- server.c	2000/11/19 14:24:18	1.20
>   +++ server.c	2000/11/21 19:15:27	1.21
>   @@ -73,7 +73,7 @@
>        const char *bind_to_ipaddr = NULL;
>        char *local_ipaddr, *remote_ipaddr;
>        apr_port_t local_port, remote_port;
>   -    apr_sockaddr_t *localsa = NULL;
>   +    apr_sockaddr_t *localsa = NULL, *remotesa;
>        apr_status_t stat;
>        int family = APR_UNSPEC;
>        char buf[128];
>   @@ -155,8 +155,8 @@
>        fprintf(stdout, "OK\n");
>    
>        if (!localsa) {
>   -        apr_set_port(sock, APR_LOCAL, 8021);
>            apr_get_sockaddr(&localsa, APR_LOCAL, sock);
>   +        apr_set_port(localsa, 8021);
>        }

This seems a bit wonky. The above code implies that an apr_get_sockaddr()
returns an address that is *attached* to the socket. That any changes to the
address will reflect within the socket.

That seems like it will introduce a number of subtle bugs.

- if people forget the attached state
- what happens when it gets passed elsewhere
- can it be used after the socket closes
- etc


Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message