Group context handling changed

parent e2c0cda6
......@@ -129,13 +129,17 @@ cmd-class class
end-class ack-class
cmd-class class
$value: msging-id$
field: peers[]
field: silent-last#
end-class msging-class
cmd-class class{ msg
$value: id$
field: peers[]
field: keys[]
field: log[]
field: mode
\ mode bits:
0 5 bits: otr# chain# redate# lock# visible#
method start
method tag
method chain
......@@ -252,7 +256,6 @@ cmd-class class
field: log-context
field: ack-context
field: msging-context
field: msg-context
field: file-state \ files
\ rest of state
field: codebuf#
......
......@@ -24,7 +24,12 @@ Forward pk-peek? ( addr u0 -- flag )
: ?hash ( addr u hash -- ) >r
2dup r@ #@ d0= IF "" 2swap r> #! ELSE 2drop rdrop THEN ;
: >group ( addr u -- ) msg-groups ?hash ;
: >group ( addr u -- )
2dup msg-group# #@ d0= IF
net2o:new-msg cell- [ msg-class >osize @ cell+ ]L
2over msg-group# #!
THEN last# cell+ $@ drop cell+ to msg-group-o
msg-groups ?hash ;
: avalanche-msg ( msg u1 o:connect -- )
\G forward message to all next nodes of that message group
......@@ -50,9 +55,6 @@ Sema msglog-sema
: ?msg-context ( -- o )
msging-context @ dup 0= IF
drop
msg-context @ 0= IF
net2o:new-msg msg-context !
THEN
net2o:new-msging dup msging-context !
THEN ;
......@@ -156,12 +158,12 @@ event: :>load-msg ( last# -- )
Sema queue-sema
\ peer queue
\ peer queue, in msg context
: peer> ( -- addr / 0 )
[: peers[] back> ;] queue-sema c-section ;
[: msg:peers[] back> ;] queue-sema c-section ;
: >peer ( addr u -- )
[: peers[] $+[]! ;] queue-sema c-section ;
[: msg:peers[] $+[]! ;] queue-sema c-section ;
\ events
......@@ -173,18 +175,18 @@ msg-notify-class ' new static-a with-allocater Constant msg-notify-o
last# >r +msg-log last# ?dup-IF $@ ?save-msg THEN r> to last# ;
: do-msg-nestsig ( addr u -- )
2dup parent .msg-context @ .msg:display
2dup msg-group-o .msg:display
msg-notify-o .msg:display ;
: display-lastn ( n -- )
net2o:new-msg >o 0 to parent msg:redisplay dispose o> ;
msg-group-o >o msg:redisplay o> ;
: display-sync-done ( -- )
rows msg-context @ .msg:redisplay ;
rows msg-group-o .msg:redisplay ;
: display-one-msg { d: msgt -- }
net2o:new-msg >o 0 to parent
msg-group-o >o
msgt ['] msg:display catch IF ." invalid entry" cr 2drop THEN
dispose o> ;
o> ;
Forward silent-join
......
......@@ -417,8 +417,9 @@ $20 cells Value resend-size#
#60.000.000.000 d>64 64Constant connect-timeout# \ 60s connect timeout
Variable init-context#
Variable msg-groups
hash: msg-groups
hash: msg-group# ( hash for group objects )
UValue msg-group-o
UValue connection
in net2o : new-log ( -- o )
......@@ -1675,7 +1676,6 @@ in net2o : dispose-context ( o:addr -- o:addr )
>o timing-stat $off track-timing $off dispose o>
THEN
msging-context @ ?dup-IF .dispose THEN
msg-context @ ?dup-IF .dispose THEN
unlink-ctx ungroup-ctx
end-semas start-semas DO I pthread_mutex_destroy drop
1 pthread-mutexes +LOOP
......@@ -1991,6 +1991,8 @@ forth-local-words:
"[ \t\n]" t name (font-lock-function-name-face . 3))
(("64field:") non-immediate (font-lock-type-face . 2)
"[ \t\n]" t name (font-lock-variable-name-face . 3))
(("hash:") non-immediate (font-lock-type-face . 2)
"[ \t\n]" t name (font-lock-variable-name-face . 3))
(("with") compile-only (font-lock-type-face . 2)
"[ \t\n]" t name (font-lock-variable-name-face . 3))
(("endwith") compile-only (font-lock-type-face . 2))
......
......@@ -389,6 +389,9 @@ Commands are context-sensitive in an OOP method hierarchy sense.
specify message URL
* $2D msg-like ( xchar -- )
add a like
* $2E msg-lock ( $:key -- )
lock down communciation
* $2F msg-unlock ( -- )
### group description commands ###
......@@ -417,11 +420,8 @@ Commands are context-sensitive in an OOP method hierarchy sense.
rewire distribution tree
* $25 msg-last? ( start end n -- )
* $26 msg-last ( $:[tick0,msgs,..tickn] n -- )
* $27 msg-key ( $:key -- )
* $A msg-nestsig ( $:cmd+sig -- )
check sig+nest
* $28 msg-nestencsig ( $:enc[cmd]+sig -- )
decrypt, chech sig+nest
### DVCS patch commands ###
......
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