summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-07-08 21:15:19 +0400
committerSam T <pxqr.sta@gmail.com>2013-07-08 21:15:19 +0400
commita437e18badb78bd4946ce4ecec830acdf000abee (patch)
tree84001c3ee85247386e3723dea34ef553636d9967 /src
parent2be391c59deb670fd8084c6bd0fa9c2cbe2fd5cf (diff)
~ Fix GHC 7.6.3 warnings.
Diffstat (limited to 'src')
-rw-r--r--src/Remote/KRPC/Protocol.hs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Remote/KRPC/Protocol.hs b/src/Remote/KRPC/Protocol.hs
index 462f72eb..2e41bb2e 100644
--- a/src/Remote/KRPC/Protocol.hs
+++ b/src/Remote/KRPC/Protocol.hs
@@ -36,9 +36,8 @@ module Remote.KRPC.Protocol
36 , encode, encoded, decode, decoded, toBEncode, fromBEncode 36 , encode, encoded, decode, decoded, toBEncode, fromBEncode
37 ) where 37 ) where
38 38
39import Prelude hiding (catch)
40import Control.Applicative 39import Control.Applicative
41import Control.Exception.Lifted 40import Control.Exception.Lifted as Lifted
42import Control.Monad 41import Control.Monad
43import Control.Monad.IO.Class 42import Control.Monad.IO.Class
44import Control.Monad.Trans.Control 43import Control.Monad.Trans.Control
@@ -213,7 +212,6 @@ sendMessage :: BEncodable msg => msg -> KRemoteAddr -> KRemote -> IO ()
213sendMessage msg (host, port) sock = 212sendMessage msg (host, port) sock =
214 sendAllTo sock (LB.toStrict (encoded msg)) (SockAddrInet port host) 213 sendAllTo sock (LB.toStrict (encoded msg)) (SockAddrInet port host)
215{-# INLINE sendMessage #-} 214{-# INLINE sendMessage #-}
216{-# SPECIALIZE sendMessage :: BEncode -> KRemoteAddr -> KRemote -> IO () #-}
217 215
218recvResponse :: KRemote -> IO (Either KError KResponse) 216recvResponse :: KRemote -> IO (Either KError KResponse)
219recvResponse sock = do 217recvResponse sock = do
@@ -230,9 +228,9 @@ remoteServer :: (MonadBaseControl IO remote, MonadIO remote)
230 -> (KRemoteAddr -> KQuery -> remote (Either KError KResponse)) 228 -> (KRemoteAddr -> KQuery -> remote (Either KError KResponse))
231 -- ^ Handler. 229 -- ^ Handler.
232 -> remote () 230 -> remote ()
233remoteServer servport action = bracket (liftIO bind) (liftIO . sClose) loop 231remoteServer servport action = bracket (liftIO bindServ) (liftIO . sClose) loop
234 where 232 where
235 bind = do 233 bindServ = do
236 sock <- socket AF_INET Datagram defaultProtocol 234 sock <- socket AF_INET Datagram defaultProtocol
237 bindSocket sock (SockAddrInet servport iNADDR_ANY) 235 bindSocket sock (SockAddrInet servport iNADDR_ANY)
238 return sock 236 return sock
@@ -249,5 +247,5 @@ remoteServer servport action = bracket (liftIO bind) (liftIO . sClose) loop
249 where 247 where
250 handleMsg bs addr = case decoded bs of 248 handleMsg bs addr = case decoded bs of
251 Right query -> (either toBEncode toBEncode <$> action addr query) 249 Right query -> (either toBEncode toBEncode <$> action addr query)
252 `catch` (return . toBEncode . serverError) 250 `Lifted.catch` (return . toBEncode . serverError)
253 Left decodeE -> return $ toBEncode (ProtocolError (BC.pack decodeE)) 251 Left decodeE -> return $ toBEncode (ProtocolError (BC.pack decodeE))