Commit d6d1fadc authored by Klaus Aehlig's avatar Klaus Aehlig

Merge branch 'stable-2.9' into stable-2.10

* stable-2.9
  Fix file descriptor leak in Confd Client
  Fix hlint warnings found by hlint 1.9.11
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parents 2f0a35cc ee2b2eda
......@@ -38,6 +38,7 @@ module Ganeti.Confd.Client
) where
import Control.Concurrent
import Control.Exception (bracket)
import Control.Monad
import Data.List
import Data.Maybe
......@@ -130,9 +131,10 @@ queryOneServer semaphore answer crType cQuery hmac (host, port) = do
addr <- resolveAddr (fromIntegral port) host
(af_family, sockaddr) <-
exitIfBad "Unable to resolve the IP address" addr
s <- S.socket af_family S.Datagram S.defaultProtocol
_ <- S.sendTo s completeMsg sockaddr
replyMsg <- S.recv s C.maxUdpDataSize
replyMsg <- bracket (S.socket af_family S.Datagram S.defaultProtocol) S.sClose
$ \s -> do
_ <- S.sendTo s completeMsg sockaddr
S.recv s C.maxUdpDataSize
parsedReply <-
if C.confdMagicFourcc `isPrefixOf` replyMsg
then return . parseReply hmac (drop 4 replyMsg) $ confdRqRsalt request
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment