mirror of
https://github.com/urbit/shrub.git
synced 2024-12-15 04:22:48 +03:00
re-notify on duplicate dns binding requests
This commit is contained in:
parent
7bfc76c4d9
commit
71641f7b93
42
app/dns.hoon
42
app/dns.hoon
@ -411,10 +411,34 @@
|
|||||||
::
|
::
|
||||||
++ create
|
++ create
|
||||||
|= [for=ship him=ship tar=target]
|
|= [for=ship him=ship tar=target]
|
||||||
:: XX defer %indirect where target isn't yet bound
|
:: XX defer %indirect where target isn't yet bound
|
||||||
|
::
|
||||||
?> ?| ?=(%direct -.tar)
|
?> ?| ?=(%direct -.tar)
|
||||||
(~(has by bon.nam) p.tar)
|
(~(has by bon.nam) p.tar)
|
||||||
==
|
==
|
||||||
|
:: ignore if binding is pending
|
||||||
|
::
|
||||||
|
=/ pending (~(get by pen.nam) him)
|
||||||
|
?: ?& ?=(^ pending)
|
||||||
|
=(tar u.pending)
|
||||||
|
==
|
||||||
|
this
|
||||||
|
:: re-notify if binding already exists
|
||||||
|
::
|
||||||
|
:: XX deduplicate with +confirm
|
||||||
|
::
|
||||||
|
=/ existing (~(get by bon.nam) him)
|
||||||
|
?: ?& ?=(^ existing)
|
||||||
|
=(tar cur.u.existing)
|
||||||
|
==
|
||||||
|
=/ wir=wire
|
||||||
|
/bound/(scot %p him)/for/(scot %p for)
|
||||||
|
=/ dom=turf
|
||||||
|
(weld dom.aut.nam /(crip +:(scow %p him)))
|
||||||
|
%- emit
|
||||||
|
[%poke wir [for dap.bow] %dns-command %bond for him dom]
|
||||||
|
:: create new or replace existing binding
|
||||||
|
::
|
||||||
=/ wir=wire
|
=/ wir=wire
|
||||||
/authority/create/(scot %p him)/for/(scot %p for)
|
/authority/create/(scot %p him)/for/(scot %p for)
|
||||||
=/ pre=(unit target)
|
=/ pre=(unit target)
|
||||||
@ -474,8 +498,20 @@
|
|||||||
?: |(?=(~ addr) ?=(%duke (clan:title him)))
|
?: |(?=(~ addr) ?=(%duke (clan:title him)))
|
||||||
[%indirect our.bow]
|
[%indirect our.bow]
|
||||||
[%direct %if u.addr]
|
[%direct %if u.addr]
|
||||||
?. |(?=(~ rel) ?=(~ dom.u.rel) !=(tar tar.u.rel))
|
:: re-notify if binding already exists
|
||||||
this
|
::
|
||||||
|
:: XX deduplicate with +confirm
|
||||||
|
::
|
||||||
|
?: ?& ?=(^ rel)
|
||||||
|
?=(^ dom.u.rel)
|
||||||
|
=(tar tar.u.rel)
|
||||||
|
==
|
||||||
|
=/ wir=wire
|
||||||
|
/bound/(scot %p him)/for/(scot %p our.bow)
|
||||||
|
%- emit
|
||||||
|
[%poke wir [him dap.bow] %dns-command %bond our.bow him u.dom.u.rel]
|
||||||
|
:: check binding target validity, store and forward
|
||||||
|
::
|
||||||
=. rel `[wen=now.bow addr dom=~ try=0 tar]
|
=. rel `[wen=now.bow addr dom=~ try=0 tar]
|
||||||
?:(?=(%indirect -.tar) bind check)
|
?:(?=(%indirect -.tar) bind check)
|
||||||
:: +check: confirm %direct target is accessible
|
:: +check: confirm %direct target is accessible
|
||||||
|
Loading…
Reference in New Issue
Block a user