Hi!

On Wed, Oct 15, 2014 at 5:45 PM, 'Klaus Aehlig' via ganeti-devel <
ganeti-devel@googlegroups.com> wrote:

> ....to determine which port to bind to. The priorities are now
> - the --port option,
> - the services entry, and
> - the default port.
>
> Signed-off-by: Klaus Aehlig <aeh...@google.com>
> ---
>  src/Ganeti/Confd/Server.hs | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/Ganeti/Confd/Server.hs b/src/Ganeti/Confd/Server.hs
> index 13a8090..dac0443 100644
> --- a/src/Ganeti/Confd/Server.hs
> +++ b/src/Ganeti/Confd/Server.hs
> @@ -45,6 +45,7 @@ import Data.IORef
>  import Data.List
>  import qualified Data.Map as M
>  import Data.Maybe (fromMaybe)
> +import Network.BSD (getServiceByName, servicePort)
>  import qualified Network.Socket as S
>  import System.Exit
>  import System.IO
> @@ -323,7 +324,10 @@ type PrepResult = (S.Socket, IORef (Result
> (ConfigData, LinkIpMap)))
>  -- | Check function for confd.
>  checkMain :: CheckFn (S.Family, S.SockAddr)
>  checkMain opts = do
> -  parseresult <- parseAddress opts C.defaultConfdPort
> +  defaultPort <- withDefaultOnIOError C.defaultConfdPort
> +                 . liftM (fromIntegral . servicePort)
> +                 $ getServiceByName C.confd "tcp"
>

Consider using a constant for "tcp".


> +  parseresult <- parseAddress opts defaultPort
>    case parseresult of
>      Bad msg -> do
>        hPutStrLn stderr $ "parsing bind address: " ++ msg
> --
> 2.1.0.rc2.206.gedb03e5
>
>
Rest LGTM


-- 
Helga Velroyen | Software Engineer | hel...@google.com |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to