summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Network/QueryResponse.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Network/QueryResponse.hs b/src/Network/QueryResponse.hs
index 9262132f..5083a87c 100644
--- a/src/Network/QueryResponse.hs
+++ b/src/Network/QueryResponse.hs
@@ -191,6 +191,16 @@ layerTransport parse encode tr =
191 sendMessage tr addr msg 191 sendMessage tr addr msg
192 } 192 }
193 193
194-- | Modify a 'Transport' to invoke an action upon every received packet.
195onInbound :: (addr -> x -> IO ()) -> Transport err addr x -> Transport err addr x
196onInbound f tr = tr
197 { awaitMessage = do
198 m <- awaitMessage tr
199 case m of
200 Just (Right (x, addr)) -> f addr x
201 Nothing -> return ()
202 return m
203 }
194 204
195-- | To dipatch responses to our outbound queries, we require three primitives. 205-- | To dipatch responses to our outbound queries, we require three primitives.
196-- See the 'transactionMethods' function to create these primitives out of a 206-- See the 'transactionMethods' function to create these primitives out of a