Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Some refactoring |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c62870935b1aaf4310f505c382adb6ac |
User & Date: | bernd 2019-10-09 22:31:07.980 |
Context
2019-10-10
| ||
17:45 | Bump version number check-in: 9277fd8b03 user: bernd tags: trunk, 0.9.1-20191010 | |
2019-10-09
| ||
22:31 | Some refactoring check-in: c62870935b user: bernd tags: trunk | |
2019-10-05
| ||
11:15 | Add EuroForth 2019 presentation check-in: e3270ebc21 user: bernd tags: trunk | |
Changes
Changes to cmd.fs.
︙ | ︙ | |||
568 569 570 571 572 573 574 | : send-cmd ( addr u dest -- size ) n64-swap { buf# } +send-cmd dest-addr 64@ 64>r set-dest cmd( <info> ." send: " outflag .dest-addr dup buf# net2o:see <default> cr ) max-size^2 1+ 0 DO buf# min-size I lshift u<= IF I outflag @ stateless# and IF send-cX ?punch-cmds ELSE | | < < < < < < | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | : send-cmd ( addr u dest -- size ) n64-swap { buf# } +send-cmd dest-addr 64@ 64>r set-dest cmd( <info> ." send: " outflag .dest-addr dup buf# net2o:see <default> cr ) max-size^2 1+ 0 DO buf# min-size I lshift u<= IF I outflag @ stateless# and IF send-cX ?punch-cmds ELSE send-reply >r over buf# r@ 2! r> send-xt THEN min-size I lshift UNLOOP 64r> dest-addr 64! EXIT THEN LOOP 64r> dest-addr 64! true !!commands!! ; : cmd ( -- ) cmdbuf# @ 1 u<= ?EXIT \ don't send if cmdbuf is empty connection >o outflag @ >r cmdbuf$ cmddest avalanche( ." send cmd: " ftime 1000e fmod (.time) 64dup x64. 64>r dup hex. 64r> cr ) msg( ." send cmd to: " 64dup x64. forth:cr ) send-cmd r> stateless# and 0= IF code-update ELSE drop THEN o> ; also net2o-base |
︙ | ︙ |
Changes to connected.fs.
︙ | ︙ | |||
584 585 586 587 588 589 590 | : reqsize! ( ucode udata -- ) to req-datasize to req-codesize ; : connect-rest ( n -- ) clean-request -timeout tskc KEYBYTES erase context! ; : end-code| ( -- ) ]] end-code client-loop [[ ; immediate compile-only | | < < < | > > > > > > | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | : reqsize! ( ucode udata -- ) to req-datasize to req-codesize ; : connect-rest ( n -- ) clean-request -timeout tskc KEYBYTES erase context! ; : end-code| ( -- ) ]] end-code client-loop [[ ; immediate compile-only : connect-request ( -- ) net2o-code0 net2o-version $, version? 0key, tpkc keysize $, receive-tmpkey nest[ cookie, gen-reply request, ]nest other tmpkey-request ind-addr @ IF punch? THEN req-codesize req-datasize map-request, close-tmpnest ['] push-cmd IS expect-reply? end-code ; : gen-request ( -- ) setup! +resend-cmd gen-tmpkeys ['] connect-rest rqd? cmd( ind-addr @ IF ." in" THEN ." direct connect" forth:cr ) ivs( ." gen request" forth:cr ) connect-request client-loop ; in net2o : connect ( ucode udata -- ) reqsize! gen-request ; previous \\\ Local Variables: |
︙ | ︙ |
Changes to net2o.fs.
︙ | ︙ | |||
1071 1072 1073 1074 1075 1076 1077 | in net2o : punch ( addr u o:connection -- ) o IF new-addr punch-addrs >stack ELSE 2drop THEN ; : punch-wrap ( xt -- ) | | | | > > > > < | < < | < | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | in net2o : punch ( addr u o:connection -- ) o IF new-addr punch-addrs >stack ELSE 2drop THEN ; : punch-wrap ( xt -- ) return-address { ret[ $10 ] } catch ret[ return-address $10 move throw ; : punch-loop ( xt -- ) [{: xt :}l punch-addrs $@ bounds ?DO I @ xt addr>sock cell +LOOP ;] punch-wrap ; : pings ( o:connection -- ) \G ping all addresses (why except the first one?) ['] ping-addr1 punch-loop ; : punchs ( addr u o:connection -- ) \G send a reply to all addresses ['] send-punch punch-loop ; \ send chunk \ branchless version using floating point : send-size ( u -- n ) min-size umax maxdata umin 1- |
︙ | ︙ |
Changes to notify.fs.
︙ | ︙ | |||
57 58 59 60 61 62 63 | ." from" notify-nick$ $. ; [IFDEF] android require android/notify.fs [ELSE] [IFDEF] linux require linux/notify.fs | < < < | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | ." from" notify-nick$ $. ; [IFDEF] android require android/notify.fs [ELSE] [IFDEF] linux require linux/notify.fs [THEN] : show-notification ( -- ) 1 pending-notifications +! [IFDEF] linux-notification linux-notification [THEN] ; |
︙ | ︙ |
Changes to tools.fs.
︙ | ︙ | |||
515 516 517 518 519 520 521 522 523 524 525 526 527 528 | rootdirs>path ; : init-dirs ( -- ) ?.net2o-config fsane-init ; previous \ print time 64Variable tick-adjust : ticks ( -- u64 ) ntime d>64 tick-adjust 64@ 64+ ; : ticks-u ( -- u ) ticks 64>n ; 1970 1 1 ymd2day Constant unix-day0 | > > | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | rootdirs>path ; : init-dirs ( -- ) ?.net2o-config fsane-init ; previous \ print time : ftime ( -- r ) ntime d>f 1e-9 f* ; 64Variable tick-adjust : ticks ( -- u64 ) ntime d>64 tick-adjust 64@ 64+ ; : ticks-u ( -- u ) ticks 64>n ; 1970 1 1 ymd2day Constant unix-day0 |
︙ | ︙ |
Changes to wiki/commands.md.
1 2 | # Commands # | | | 1 2 3 4 5 6 7 8 9 10 | # Commands # Version 0.9.1-20191003. net2o separates data and commands. Data is passed through to higher layers, commands are interpreted when they arrive. For connection requests, a special bit is set, and the address then isn't used as address, but as IV for the opportunistic encoding. The command interpreter is a stack machine with two data types: 64 |
︙ | ︙ |