Commit d79511b3 authored by bernd's avatar bernd

Bob test with balanced object stack

parent 8172c6d8
......@@ -20,11 +20,11 @@ init-client
: c:lookup ( addr u -- )
$2000 $10000 "test" ins-ip c:connect
BEGIN 2dup c:addme-fetch-host 0 >o
nick-key ke-pk $@ >d#id
0 d#id @ k#host cells + $[]@ over c@ '!' = WHILE
replace-key ke-nick $@ o>
REPEAT o> 2drop do-disconnect ;
BEGIN 2dup ~~ c:addme-fetch-host ~~ o >o
nick-key ke-pk $@ o> ~~ >d#id
0 dht-host $[]@ over c@ '!' = WHILE
~~ replace-key ~~ ke-nick $@ ~~ n:o>
REPEAT n:o> 2drop do-disconnect ;
: c:insert-host ( addr u -- )
host>$ IF
[: check-addr1 0= IF 2drop EXIT THEN
......
......@@ -18,7 +18,7 @@ init-client
?nextarg [IF] s>number drop to net2o-port [THEN]
: c:revoke-bob ( -- )
o >o me>d#id o> now>never
me>d#id n:o> now>never
x" D82AF4AE7CD3DA7316CE6F26BC5792F4F5E6B36B4C14F7D60C49B421AE1D5468"
revoke-me ;
......@@ -27,7 +27,7 @@ init-client
." Bob connected" cr
c:revoke-bob
." Bob revoked" cr
o >o me>d#id o> replace-me
me>d#id n:o> replace-me
." Bob replaced" cr
do-disconnect ;
......
......@@ -87,11 +87,11 @@ previous
cookie+request
end-code| ;
: c:addme-fetch-host ( nick u -- ) +addme
net2o-code
: c:addme-fetch-host ( nick u -- ) +addme connection @ o ~~ 2drop
net2o-code ~~
expect-reply get-ip fetch-host, replaceme,
cookie+request
end-code| -setip n2o:send-replace ;
~~ cookie+request
end-code| ~~ -setip ~~ n2o:send-replace ~~ ;
: c:fetch-tags ( -- )
net2o-code
......
......@@ -239,8 +239,9 @@ User cmdbuf#
: cmdbuf ( -- addr ) cmd0source @ dup 0= IF drop code-dest THEN ;
\ : cmdbuf# ( -- addr ) cmd0source @ IF cmd0buf# ELSE codebuf# THEN ;
: cmdlock ( -- addr ) cmd0source @ IF cmd0lock ELSE code-lock THEN ;
: connection@ ( -- addr/0 ) o IF connection @ ELSE 0 THEN ;
: cmdlock ( -- addr ) cmd0source @ IF cmd0lock ELSE
connection@ .code-lock THEN ;
: cmdbuf$ ( -- addr u ) connection@ >o cmdbuf cmdbuf# @ o> ;
: endcmdbuf ( -- addr' ) connection@ >o cmdbuf maxdata + o> ;
: maxstring ( -- n ) endcmdbuf cmdbuf$ + - ;
......@@ -281,8 +282,8 @@ comp: :, also net2o-base ;
64dup 64-0= !!no-dest!! THEN ;
: cmd ( -- ) cmdbuf# @ 2 u< ?EXIT \ don't send if cmdbuf is empty
cmdbuf cmdbuf# @ cmddest send-cmd
cmd0source @ 0= IF code-update punch-load $off THEN ;
connection@ >o cmdbuf cmdbuf# @ cmddest send-cmd
cmd0source @ 0= IF code-update punch-load $off THEN o> ;
also net2o-base
......@@ -311,7 +312,8 @@ previous
acked 0. rot reply[] 2! ; \ clear request
: net2o:expect-reply ( -- ) o?
timeout( cmd( ." expect: " cmdbuf$ n2o:see ) )
cmdbuf$ code-reply dup >r 2! code-vdest r> reply-dest 64! ;
cmdbuf$
connection@ >o code-reply dup >r 2! code-vdest r> reply-dest 64! o> ;
: tag-addr? ( -- flag )
tag-addr dup >r 2@
......@@ -400,7 +402,7 @@ also net2o-base definitions
: dfloat, ( r -- ) sflit cmdbuf$ + df! 1 dfloats cmdbuf+ ;
: flag, ( flag -- ) IF tru ELSE fals THEN ;
: (end-code) ( -- ) expect-reply? cmd cmdlock unlock ;
: end-code ( -- ) (end-code) previous ;
: end-code ( -- ) (end-code) previous ;
comp: :, previous ;
: push-cmd ( -- )
end-cmd ['] end-cmd IS expect-reply? cmdbuf$ push-reply ;
......
......@@ -271,7 +271,7 @@ dht-table ' new static-a with-allocater constant dht-stub
ELSE connection @ d#id @ >o rdrop connection ! THEN ;
: (d#value+) ( addr u key -- ) \ without sanity checks
cells dup k#size u>= !!no-dht-key!!
dht-hash + dht( dup hex. dup $[]# F . F cr ) $ins[]sig ;
dht-hash + dht( ." ins into: " dup hex. dup $[]# F . F cr ) $ins[]sig ;
: .tag ( addr u -- ) 2dup 2>r
>tag verify-tag >r sigpksize# - type r> 2r> .sigdates .check ;
......@@ -441,21 +441,21 @@ also net2o-base
pkc keysize 2* $, dht-id <req k#host ulit, dht-value? req> endwith ;
: remove-me, ( -- )
d#id @ .dht-host dup
d#id @ .dht-host dup >r
[: sigsize# - 2dup + sigdate datesize# move
gen-host-del $, k#host ulit, dht-value- ;] $[]map
$[]off ;
r> $[]off ;
previous
: me>d#id ( -- ) pkc keysize 2* >d#id ?d#id ;
: n2o:send-replace ( -- )
me>d#id o IF
me>d#id d#id @ IF
net2o-code expect-reply
pkc keysize 2* $, dht-id remove-me, endwith
cookie+request
end-code|
THEN ;
THEN n:o> ;
: set-revocation ( addr u -- )
d#id @ .dht-host $+[]! ;
......@@ -472,7 +472,8 @@ Defer renew-key
: replace-me ( -- ) +addme
net2o-code expect-reply get-ip replaceme, cookie+request
end-code| -setip n2o:send-replace ;
end-code| -setip
n2o:send-replace ;
: revoke-me ( addr u -- )
\G give it your revocation secret
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment