sociomantic-tsunami / ocean

General purpose, platform-dependent, high-performance library for D
Other
61 stars 56 forks source link

Make use of `IP_FREEBIND` in listeners. #165

Open nemanja-boric-sociomantic opened 7 years ago

nemanja-boric-sociomantic commented 7 years ago

from man 7 ip:

       IP_FREEBIND (since Linux 2.4)
              If enabled, this boolean option allows binding to an IP
              address that is nonlocal or does not (yet) exist.  This
              permits listening on a socket, without requiring the
              underlying network interface or the specified dynamic IP
              address to be up at the time that the application is trying to
              bind to it.  This option is the per-socket equivalent of the
              ip_nonlocal_bind /proc interface described below.
david-eckardt-sociomantic commented 7 years ago

How is this useful for us?

nemanja-boric-sociomantic commented 7 years ago

As applications are able to bind on the given address, it is possible that no interfaces have yet obtained the IP address. In that case, it is desirable to start up the daemon anyway, so that it can startup with the routing in parallel without crashing (as bind will fail), or without synchronizing the application to startup after it. IP_FREEBIND has been developed just for that case.