summaryrefslogtreecommitdiff
path: root/dht/src/Network/QueryResponse.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-12-19 16:49:18 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-01 23:27:24 -0500
commit89c516018e51c4f15ace02d974a7a959f8c219a9 (patch)
tree5b6a0ad4adbe4d36c0230370697b41bae3ddab0c /dht/src/Network/QueryResponse.hs
parentffaae666cf69e7555d0f47324d0afabc0347829c (diff)
Minor refactor.
Diffstat (limited to 'dht/src/Network/QueryResponse.hs')
-rw-r--r--dht/src/Network/QueryResponse.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/dht/src/Network/QueryResponse.hs b/dht/src/Network/QueryResponse.hs
index 89723da2..44039ee0 100644
--- a/dht/src/Network/QueryResponse.hs
+++ b/dht/src/Network/QueryResponse.hs
@@ -161,6 +161,10 @@ partitionTransport parse encodex tr =
161-- * f add x --> Nothing, consume x 161-- * f add x --> Nothing, consume x
162-- --> Just id, leave x to a different handler 162-- --> Just id, leave x to a different handler
163-- --> Just g, apply g to x and leave that to a different handler 163-- --> Just g, apply g to x and leave that to a different handler
164--
165-- Note: If you add a handler to one of the branches before applying a
166-- 'mergeTransports' combinator, then this handler may not block or return
167-- Nothing.
164addHandler :: (err -> IO ()) -> (addr -> x -> IO (Maybe (x -> x))) -> Transport err addr x -> Transport err addr x 168addHandler :: (err -> IO ()) -> (addr -> x -> IO (Maybe (x -> x))) -> Transport err addr x -> Transport err addr x
165addHandler onParseError f tr = tr 169addHandler onParseError f tr = tr
166 { awaitMessage = \kont -> fix $ \eat -> awaitMessage tr $ \case 170 { awaitMessage = \kont -> fix $ \eat -> awaitMessage tr $ \case