diff options
Diffstat (limited to 'src/Remote/KRPC/Protocol.hs')
-rw-r--r-- | src/Remote/KRPC/Protocol.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Remote/KRPC/Protocol.hs b/src/Remote/KRPC/Protocol.hs index 4fbe517c..45ce2bb0 100644 --- a/src/Remote/KRPC/Protocol.hs +++ b/src/Remote/KRPC/Protocol.hs | |||
@@ -206,8 +206,6 @@ sendMessage msg (host, port) sock = | |||
206 | {-# INLINE sendMessage #-} | 206 | {-# INLINE sendMessage #-} |
207 | {-# SPECIALIZE sendMessage :: BEncode -> KRemoteAddr -> KRemote -> IO () #-} | 207 | {-# SPECIALIZE sendMessage :: BEncode -> KRemoteAddr -> KRemote -> IO () #-} |
208 | 208 | ||
209 | |||
210 | -- TODO check scheme | ||
211 | recvResponse :: KRemote -> IO (Either KError KResponse) | 209 | recvResponse :: KRemote -> IO (Either KError KResponse) |
212 | recvResponse sock = do | 210 | recvResponse sock = do |
213 | (raw, _) <- recvFrom sock maxMsgSize | 211 | (raw, _) <- recvFrom sock maxMsgSize |
@@ -217,10 +215,11 @@ recvResponse sock = do | |||
217 | Right kerror -> kerror | 215 | Right kerror -> kerror |
218 | _ -> ProtocolError (BC.pack decE) | 216 | _ -> ProtocolError (BC.pack decE) |
219 | 217 | ||
220 | 218 | -- | Run server using a given port. Method invocation should be done manually. | |
221 | remoteServer :: (MonadBaseControl IO remote, MonadIO remote) | 219 | remoteServer :: (MonadBaseControl IO remote, MonadIO remote) |
222 | => PortNumber | 220 | => PortNumber -- ^ Port number to listen. |
223 | -> (KRemoteAddr -> KQuery -> remote (Either KError KResponse)) | 221 | -> (KRemoteAddr -> KQuery -> remote (Either KError KResponse)) |
222 | -- ^ Handler. | ||
224 | -> remote () | 223 | -> remote () |
225 | remoteServer servport action = bracket (liftIO bind) (liftIO . sClose) loop | 224 | remoteServer servport action = bracket (liftIO bind) (liftIO . sClose) loop |
226 | where | 225 | where |