Revision 199b241c

b/src/Ganeti/Confd/Client.hs
42 42
import qualified Ganeti.Constants as C
43 43
import Ganeti.Hash
44 44
import Ganeti.Ssconf
45
import Ganeti.Utils
45 46

  
46 47
-- | Builds a properly initialized ConfdClient.
47 48
-- The parameters (an IP address and the port number for the Confd client
......
117 118
  let signedMsg =
118 119
        signMessage hmac timestamp (J.encodeStrict request)
119 120
      completeMsg = C.confdMagicFourcc ++ J.encodeStrict signedMsg
120
  s <- S.socket S.AF_INET S.Datagram S.defaultProtocol
121
  hostAddr <- S.inet_addr host
122
  _ <- S.sendTo s completeMsg $ S.SockAddrInet port hostAddr
121
  addr <- resolveAddr (fromIntegral port) host
122
  (af_family, sockaddr) <-
123
    exitIfBad "Unable to resolve the IP address" addr
124
  s <- S.socket af_family S.Datagram S.defaultProtocol
125
  _ <- S.sendTo s completeMsg sockaddr
123 126
  replyMsg <- S.recv s C.maxUdpDataSize
124 127
  parsedReply <-
125 128
    if C.confdMagicFourcc `isPrefixOf` replyMsg

Also available in: Unified diff