Bug 585575 – g_socket_listener_add_inet_port()
authorRyan Lortie <desrt@desrt.ca>
Fri, 12 Jun 2009 17:01:04 +0000 (13:01 -0400)
committerRyan Lortie <desrt@desrt.ca>
Fri, 12 Jun 2009 17:01:04 +0000 (13:01 -0400)
commitcb1a6092405b2f6d9b82e7c1b757951d695c5fe6
tree8fef2865f8ae63d668416953892cc33ceaf943dc
parentf7d756f5b6c9975452e57ac6f41ff69d9f456739
Bug 585575 – g_socket_listener_add_inet_port()

Change the logic in g_socket_listener_add_inet_port() as per the
reasoning in the bug report.

  - If the OS supports neither IPv6 or IPv4, fail.
  - If the OS supports only IPv6, do that.
  - If the OS supports only IPv4, do that.
  - If the OS supports IPv6 and IPv6 "speaks" IPv4 then bind it
    and be done.
  - If the OS supports IPv6 and IPv6 doesn't "speak" IPv4 then
    create an additional socket for IPv4.
  - If binding any socket fails then fail the entire call.

Also, remove the ability to call this function with port == 0.  This
is a useless thing to do anyway since you have no way to know what
port number was actually allocated.  We should have a separate
function to deal with this.
gio/gsocketlistener.c