Commit d1565e06 authored by bernd's avatar bernd

Limit symmetric openness to connection phase

parent ced820d6
......@@ -331,7 +331,7 @@ cell 8 = [IF] 6 [ELSE] 5 [THEN] Constant cell>>
2dup + n2o:new-map lit, swap ulit, ulit,
map-request ;
: gen-request ( -- ) o IF setup! THEN
: gen-request ( -- ) setup!
cmd( ind-addr @ IF ." in" THEN ." direct connect" F cr )
net2o-code0
['] end-cmd IS expect-reply?
......
......@@ -189,8 +189,7 @@ User last-ivskey
: inbuf0-decrypt ( -- flag ) +calc
inbuf addr 64@ inbuf flags w@ addr>assembly
my-0key try-0decrypt dup IF EXIT THEN drop
0 [: ." inbuf0 context " o hex.
dest-0key try-0decrypt or dup 0= ;] search-context ;
false [: try-0decrypt or dup 0= ;] search-0key ;
: outbuf0-encrypt ( -- ) +calc
outbuf addr 64@ outbuf flags w@ addr>assembly
......
......@@ -1177,6 +1177,26 @@ UValue connection
endof
!!no-addr!! endcase ;
\ insert keys
Variable 0keys
sema 0key-sema
: ins-0key [: { w^ addr -- }
addr cell 0keys $+! ;] 0key-sema c-section ;
: del-0key ( addr -- )
[: 0keys $@ bounds ?DO
dup I @ = IF
0keys I over @ - cell $del LEAVE
THEN
cell +LOOP drop ;] 0key-sema c-section ;
: search-0key ( .. xt -- .. )
[: { xt } 0keys $@ bounds ?DO
I xt execute 0= ?LEAVE
cell +LOOP
;] 0key-sema c-section ;
\ create new maps
Variable mapstart $1 mapstart !
......@@ -1185,8 +1205,8 @@ Variable mapstart $1 mapstart !
parent @ 0= IF is-server ELSE parent @ .recurse THEN ;
: server? ( -- flag ) >is-server c@ negate ;
: server! ( -- ) 1 >is-server c! ;
: setup! ( -- ) setup-table @ token-table ! ;
: context! ( -- ) context-table @ token-table ! ;
: setup! ( -- ) setup-table @ token-table ! dest-0key @ ins-0key ;
: context! ( -- ) context-table @ token-table ! dest-0key @ del-0key ;
: pow2? ( n -- n ) dup dup 1- and 0<> !!pow2!! ;
: n2o:new-map ( u -- addr )
......@@ -1234,24 +1254,6 @@ Variable mapstart $1 mapstart !
contexts BEGIN @ dup WHILE >o xt execute
next-context o> swap 0= UNTIL THEN drop ;
Variable 0keys
sema 0key-sema
: ins-0key [: { w^ addr -- }
addr cell 0keys $+! ;] 0key-sema c-section ;
: del-0key ( addr -- )
[: 0keys $@ bounds ?DO
dup I @ = IF
0keys I over @ - cell $del LEAVE
THEN
cell +LOOP drop ;] 0key-sema c-section ;
: search-0key ( .. xt -- .. )
[: { xt } 0keys $@ bounds ?DO
I xt execute 0= ?LEAVE
cell +LOOP
;] 0key-sema c-section ;
\ data sending around
: >blockalign ( n -- block )
......@@ -2360,7 +2362,7 @@ $10 Constant tmp-crypt-val
mpubkey $off
log-context @ .dispose
ack-context @ >o timing-stat $off track-timing $off dispose o>
unlink-ctx
unlink-ctx dest-0key @ del-0key
dispose 0 to connection
cmd( ." disposed" cr ) ;] file-sema c-section ;
......
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