mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 08:32:39 +03:00
fix provider connection on ping
This commit is contained in:
parent
c8bd7c0d17
commit
6a9aac670c
@ -2,9 +2,8 @@
|
||||
The below requires norsyr's fix to `decompress-point` in order to work.
|
||||
|
||||
## Set Credentials and Ping Servers
|
||||
(don't need password if all run on localhost)
|
||||
```
|
||||
=rpc-pass '3d9247bcdf7787f160a109c6853b065946f6cb7a9a54157f7c3c89104edb1ac0'
|
||||
=rpc-pass '9cd2f14f9855ea5eec587935887e83c39494a35f036a9ef30abcb12df6ccf0fe'
|
||||
:btc-provider|command [%set-credentials [rpc-url='http://localhost:8332' rpc-user='__cookie__' rpc-pass] [rpc-url='http://localhost:50002']]
|
||||
|
||||
:btc-provider|action ['addr0' %address-info [%bech32 'bc1q59u5epktervh6fxqay2dlph0wxu9hjnx6v8n66']]
|
||||
|
@ -73,13 +73,7 @@
|
||||
:: check for connectivity every 30 seconds
|
||||
::
|
||||
?: ?=([%ping-timer *] wire)
|
||||
:_ this
|
||||
:~ :* %pass /ping/[(scot %da now.bowl)] %agent
|
||||
[our.bowl %btc-provider] %poke
|
||||
%btc-provider-action !>([%blank-id %ping ~])
|
||||
==
|
||||
(start-ping-timer:hc ~s30)
|
||||
==
|
||||
[do-ping:hc this]
|
||||
=^ cards state
|
||||
?+ +<.sign-arvo (on-arvo:def wire sign-arvo)
|
||||
%http-response
|
||||
@ -96,15 +90,12 @@
|
||||
^- (quip card _state)
|
||||
?- -.comm
|
||||
%set-credentials
|
||||
:- ~[(send-status %connected) (start-ping-timer ~s30)]
|
||||
state(host-info [creds.comm connected=%.y clients=*(set ship)])
|
||||
:- do-ping
|
||||
state(host-info [creds.comm connected=%.n clients=*(set ship)])
|
||||
::
|
||||
%whitelist-clients
|
||||
`state(whitelist (~(uni in whitelist) clients.comm))
|
||||
==
|
||||
++ start-ping-timer
|
||||
|= interval=@dr ^- card
|
||||
[%pass /ping-timer %arvo %b %wait (add now.bowl interval)]
|
||||
:: if not connected, only %ping action is allowed
|
||||
::
|
||||
++ handle-action
|
||||
@ -210,21 +201,35 @@
|
||||
::
|
||||
++ send-status
|
||||
|= =status ^- card
|
||||
[%give %fact ~ %btc-provider-status !>(status)]
|
||||
[%give %fact ~[/clients] %btc-provider-status !>(status)]
|
||||
++ send-update
|
||||
|= =update
|
||||
^- card
|
||||
~& >> "send-update: {<update>}"
|
||||
[%give %fact [/clients]~ %btc-provider-update !>(update)]
|
||||
[%give %fact ~[/clients] %btc-provider-update !>(update)]
|
||||
::
|
||||
++ is-whitelisted
|
||||
|= user=ship ^- ?
|
||||
?| (~(has in whitelist) user)
|
||||
=(our.bowl user)
|
||||
==
|
||||
::
|
||||
++ is-client
|
||||
|= user=ship ^- ?
|
||||
(~(has in clients.host-info) user)
|
||||
::
|
||||
++ start-ping-timer
|
||||
|= interval=@dr ^- card
|
||||
[%pass /ping-timer %arvo %b %wait (add now.bowl interval)]
|
||||
::
|
||||
++ do-ping
|
||||
^- (list card)
|
||||
:~ :* %pass /ping/[(scot %da now.bowl)] %agent
|
||||
[our.bowl %btc-provider] %poke
|
||||
%btc-provider-action !>([%blank-id %ping ~])
|
||||
==
|
||||
(start-ping-timer ~s30)
|
||||
==
|
||||
:: RPC JSON helper gates
|
||||
:: TODO: move these to /lib
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user