If the host passed in to misc.port_available is None, then it is changed to be socket.gethostname(). So the socket.getaddrinfo should return an address for the hostname. The only way sockaddr should be localhost would be if the return value of gethostname was localhost.
Tom Shawn Walker wrote: > Tom Mueller (pkg-discuss) wrote: >> Here is a code review request for two issues with the >> misc.port_available method. >> >> Issues: >> http://defect.opensolaris.org/bz/show_bug.cgi?id=2695 >> http://defect.opensolaris.org/bz/show_bug.cgi?id=2705 >> >> Webrev: >> http://cr.opensolaris.org/~tmueller/cr-2695,2705/ >> >> The fix for 2695 is to use the sockaddr variable for the address >> rather than the (host, port) tuple. This make it work for older >> versions of Mac/OS. The fix for 2705 is to add an exception catching >> clause for the socket.timeout exception. If we timeout trying to >> connect to the port, then the port should be available for use so we >> return true. > > As the original author, I also agree with the changes. > > The socket.timeout makes sense, and is a logical extension to my > comment about timeouts on some systems. > > The only concern I have about using sockaddr is whether that will ever > connect to loopback instead of the host... > > Otherwise, looks fine to me. > _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
