<listen> element of the configuration file

Havoc Pennington hp at redhat.com
Tue Mar 6 11:10:20 PST 2007


Ralf Habacker wrote:
> On windows the autoport selecting behavior is implemented by using
> port=0  in the listen statement
> 
>     <listen>tcp:host=localhost,port=0</listen>
> 
> using the following patch.
> 

Nothing windows-specific here that I see, other than possibly (I don't 
know) the details of how we invoke the socket APIs.

I think port=0 should still be disallowed in the text address (instead, 
the port attribute should be omitted to have the OS choose the port).

I would make dbus_transport_new_for_tcp_socket accept -1 for the port to 
mean "pick a port for me." The address returned from 
_dbus_transport_get_address is constructed in new_for_tcp_socket; it 
needs to be constructed so it contains the *actual* port that was used.
Then this address can be printed or set in the environment, just as it 
is for the unix domain socket address.

The change to _dbus_transport_open_socket just has to allow a port of -1 
to be passed to new_for_tcp_socket if the port is not in the address.

Havoc



More information about the dbus mailing list