Check-in [45aec71ad2]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Forward state what you have
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 45aec71ad2328f2da98929db4ea00f83f1f07c0c
User & Date: bernd 2020-03-04 22:44:17.933
Context
2020-03-05
14:42
Factoring out >fetch-queue check-in: 86856020fd user: bernd tags: trunk
2020-03-04
22:44
Forward state what you have check-in: 45aec71ad2 user: bernd tags: trunk
2020-02-27
12:26
Bump version number check-in: 4ecf9f79f5 user: bernd tags: trunk, 0.9.7-20200227
Changes
Unified Diff Ignore Whitespace Patch
Changes to msg.fs.
315
316
317
318
319
320
321
322

323
324
325
326
327
328
329
330
331
332
333







334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
Forward msg:last?
Forward msg:last
Forward msg:want

hash: fetch-finish#
Variable fetch-queue[]

hash: have#


: .@host.id ( pk+host u -- )
    '@' emit
    2dup keysize2 safe/string type '.' emit
    key2| .simple-id ;
: .ihaves ( -- )
    ." ====== hash owend by ======" cr
    have# [: dup $@ 85type ." :"
	cell+ $@ bounds U+DO
	    space I $@ .@host.id
	cell +LOOP cr ;] #map ;








: msg:ihave ( id u1 hash u2 -- )
\    ." ihave:" 2over dump 2dup dump
    2dup ihave$ $+!  2over mehave$ $!
    bounds U+DO  2dup I keysize have# #!ins[]  keysize +LOOP  2drop ;
: pk.host ( -- addr u ) [: pk@ type host$ $. ;] $tmp ;
: >ihave ( hash u -- )
    pk.host 2swap  msg:ihave ;

: push-msg ( o:parent -- )
    up@ receiver-task <> IF
	avalanche-msg
    ELSE wait-task @ ?dup-IF
	    <event >r o elit, msg-group-o elit,
	    :>avalanche r> event>







|
>











>
>
>
>
>
>
>







|







315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
Forward msg:last?
Forward msg:last
Forward msg:want

hash: fetch-finish#
Variable fetch-queue[]

hash: have#       \ list of owner ids per hash
hash: have-group# \ list of interested groups per hash

: .@host.id ( pk+host u -- )
    '@' emit
    2dup keysize2 safe/string type '.' emit
    key2| .simple-id ;
: .ihaves ( -- )
    ." ====== hash owend by ======" cr
    have# [: dup $@ 85type ." :"
	cell+ $@ bounds U+DO
	    space I $@ .@host.id
	cell +LOOP cr ;] #map ;

: >send-have ( addr u -- )
    have-group# #@ dup IF
	bounds ?DO
	    I @ to msg-group-o 0 .avalanche-msg
	cell +LOOP
    THEN ;

: msg:ihave ( id u1 hash u2 -- )
\    ." ihave:" 2over dump 2dup dump
    2dup ihave$ $+!  2over mehave$ $!
    bounds U+DO  2dup I keysize have# #!ins[]  keysize +LOOP  2drop ;
: pk.host ( -- addr u ) [: pk@ type host$ $. ;] $tmp ;
: >ihave ( hash u -- )
    pk.host 2over  msg:ihave  >send-have ;

: push-msg ( o:parent -- )
    up@ receiver-task <> IF
	avalanche-msg
    ELSE wait-task @ ?dup-IF
	    <event >r o elit, msg-group-o elit,
	    :>avalanche r> event>
635
636
637
638
639
640
641







642

643
644
645
646
647
648
649
650
event: :>queued ( queue -- )
    [: 0 fetch-queue[] !@ queue? off ;] resize-sema c-section
    transmit-queue ;
: enqueue ( -- )
    -1 queue? !@ 0= IF  <event :>queued up@ event>  THEN ;

forward need-hashed?







: ?fetch ( addr u -- )

    key| 2dup need-hashed? IF
	fetch-queue[] ['] $ins[] resize-sema c-section drop
    ELSE  2drop  THEN ;

: .posting ( addr u -- )
    2dup keysize /string
    2dup printable? IF  '[' emit type '@' emit
    ELSE  ." #["  85type ." /@"  THEN







>
>
>
>
>
>
>

>
|







643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
event: :>queued ( queue -- )
    [: 0 fetch-queue[] !@ queue? off ;] resize-sema c-section
    transmit-queue ;
: enqueue ( -- )
    -1 queue? !@ 0= IF  <event :>queued up@ event>  THEN ;

forward need-hashed?
: >have-group ( addr u -- )
    msg-group-o { w^ grp }
    2dup have-group# #@ nip IF
	grp last# cell+ +unique$
    ELSE
	grp cell 2swap have-group# #!
    THEN ;
: ?fetch ( addr u -- )
    key| 2dup >have-group
    2dup need-hashed? IF
	fetch-queue[] ['] $ins[] resize-sema c-section drop
    ELSE  2drop  THEN ;

: .posting ( addr u -- )
    2dup keysize /string
    2dup printable? IF  '[' emit type '@' emit
    ELSE  ." #["  85type ." /@"  THEN