adds /requests subscription interfacee to %dns-collector

This commit is contained in:
Joe Bryan 2019-06-07 14:43:20 -07:00
parent b5beb4be63
commit 1411347543
2 changed files with 14 additions and 1 deletions

View File

@ -18,6 +18,7 @@
+$ in-peer-data ~
+$ out-peer-data
$% [%dns-binding =binding:dns]
[%dns-request =request:dns]
==
++ tapp (^tapp app-state peek-data in-poke-data out-poke-data in-peer-data out-peer-data)
++ stdio (^stdio out-poke-data out-peer-data)
@ -58,7 +59,9 @@
?: &(?=(^ req) =(adr u.req))
(pure:m state)
:: XX check address?
=. requested.state (~(put by requested.state) who adr)
=/ =request:dns [who adr]
=. requested.state (~(put by requested.state) request)
;< ~ bind:m (give-result:stdio /requests %dns-request request)
(pure:m state)
::
%dns-complete
@ -100,6 +103,15 @@
~| %default-tapp-no-sole !!
?. ?=([@ ~] path)
~| %invalid-path !!
?: ?=(%requests i.path)
=/ requests ~(tap by requested.state)
|- ^- form:m
=* loop $
?~ requests
(pure:m state)
;< ~ bind:m (give-result:stdio path %dns-request i.requests)
loop(requests t.requests)
::
=/ who (slaw %p i.path)
?~ who
~| %invalid-path !!

View File

@ -1,4 +1,5 @@
|%
+$ address [%if if=@if]
+$ binding [=address =turf]
+$ request [=ship =address]
--