On Fri 07 Mar 2014 12:39:24 Jan Stancek wrote:
> Returns unused port number for specified domain/type.

the new func isn't race free, but it is way better than the current code, and 
the race is pretty small.  so LGTM.

> +unsigned short tst_get_unused_port(unsigned short family, int type,
> +     void (cleanup_fn)(void))
> +{
> +     int sock;
> +     struct sockaddr_in addr4;
> +     struct sockaddr_in6 addr6;

the current code works, but isn't the point of sockaddr_storage to avoid this 
duplicated storage logic ?  so you could just do:
        struct sockaddr_storage _addr;
        struct sockaddr *addr = (struct sockaddr *)&_addr;
        struct sockaddr_in *addr4 = (struct sockaddr_in *)addr;
        struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to