Revision 62d5242b
b/htools/Ganeti/Luxi.hs | ||
---|---|---|
55 | 55 |
import Control.Exception (catch) |
56 | 56 |
import Data.IORef |
57 | 57 |
import qualified Data.ByteString as B |
58 |
import qualified Data.ByteString.Lazy as BL |
|
58 | 59 |
import qualified Data.ByteString.UTF8 as UTF8 |
60 |
import qualified Data.ByteString.Lazy.UTF8 as UTF8L |
|
59 | 61 |
import Data.Word (Word8) |
60 | 62 |
import Control.Monad |
61 | 63 |
import Text.JSON (encodeStrict, decodeStrict) |
... | ... | |
245 | 247 |
-- | Sends a message over a luxi transport. |
246 | 248 |
sendMsg :: Client -> String -> IO () |
247 | 249 |
sendMsg s buf = withTimeout luxiDefRwto "sending luxi message" $ do |
248 |
let encoded = UTF8.fromString buf |
|
250 |
let encoded = UTF8L.fromString buf
|
|
249 | 251 |
handle = socket s |
250 |
B.hPut handle encoded |
|
252 |
BL.hPut handle encoded
|
|
251 | 253 |
B.hPut handle bEOM |
252 | 254 |
hFlush handle |
253 | 255 |
|
Also available in: Unified diff