Revision 4cd79ca8

b/htools/Ganeti/Confd/Server.hs
44 44
import qualified Text.JSON as J
45 45
import System.INotify
46 46

  
47
import Ganeti.BasicTypes
47 48
import Ganeti.Daemon
48 49
import Ganeti.JSON
49
import Ganeti.HTools.Types
50 50
import Ganeti.Objects
51 51
import Ganeti.Confd
52 52
import Ganeti.Confd.Utils
b/htools/Ganeti/HTools/Rapi.hs
66 66

  
67 67
#else
68 68

  
69
-- | Connection timeout (when using non-file methods).
70
connTimeout :: Long
71
connTimeout = 15
72

  
73
-- | The default timeout for queries (when using non-file methods).
74
queryTimeout :: Long
75
queryTimeout = 60
76

  
69 77
-- | The curl options we use.
70 78
curlOpts :: [CurlOption]
71 79
curlOpts = [ CurlSSLVerifyPeer False
72 80
           , CurlSSLVerifyHost 0
73
           , CurlTimeout (fromIntegral queryTimeout)
74
           , CurlConnectTimeout (fromIntegral connTimeout)
81
           , CurlTimeout queryTimeout
82
           , CurlConnectTimeout connTimeout
75 83
           ]
76 84

  
77 85
getUrl url = do
b/htools/Ganeti/HTools/Types.hs
72 72
  , FailStats
73 73
  , OpResult(..)
74 74
  , opToResult
75
  , connTimeout
76
  , queryTimeout
77 75
  , EvacMode(..)
78 76
  , ISpec(..)
79 77
  , IPolicy(..)
......
319 317
-- | A list of command elements.
320 318
type JobSet = [MoveJob]
321 319

  
322
-- | Connection timeout (when using non-file methods).
323
connTimeout :: Int
324
connTimeout = 15
325

  
326
-- | The default timeout for queries (when using non-file methods).
327
queryTimeout :: Int
328
queryTimeout = 60
329

  
330 320
-- | Default max disk usage ratio.
331 321
defReservedDiskRatio :: Double
332 322
defReservedDiskRatio = 0
b/htools/Ganeti/Luxi.hs
67 67
import System.Timeout
68 68
import qualified Network.Socket as S
69 69

  
70
import Ganeti.BasicTypes
70 71
import Ganeti.JSON
71
import Ganeti.HTools.Types
72 72
import Ganeti.Utils
73 73

  
74 74
import Ganeti.Constants
......
214 214
getClient :: String -> IO Client
215 215
getClient path = do
216 216
  s <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
217
  withTimeout connTimeout "creating luxi connection" $
217
  withTimeout luxiDefCtmo "creating luxi connection" $
218 218
              S.connect s (S.SockAddrUnix path)
219 219
  rf <- newIORef B.empty
220 220
  h <- S.socketToHandle s ReadWriteMode
......
250 250

  
251 251
-- | Sends a message over a luxi transport.
252 252
sendMsg :: Client -> String -> IO ()
253
sendMsg s buf = withTimeout queryTimeout "sending luxi message" $ do
253
sendMsg s buf = withTimeout luxiDefRwto "sending luxi message" $ do
254 254
  let encoded = UTF8.fromString buf
255 255
      handle = socket s
256 256
  B.hPut handle encoded
......
262 262
-- message and the leftover buffer contents.
263 263
recvUpdate :: Handle -> B.ByteString -> IO (B.ByteString, B.ByteString)
264 264
recvUpdate handle obuf = do
265
  nbuf <- withTimeout queryTimeout "reading luxi response" $ do
265
  nbuf <- withTimeout luxiDefRwto "reading luxi response" $ do
266 266
            _ <- hWaitForInput handle (-1)
267 267
            B.hGetNonBlocking handle 4096
268 268
  let (msg, remaining) = B.break (eOM ==) nbuf

Also available in: Unified diff