Check-in [e4211e87dc]
Not logged in

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

Overview
Comment:minimum blocksize
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e4211e87dcc64346daf30995ae4bbf909e2cda8a
User & Date: bernd 2020-02-03 17:06:39
Context
2020-02-03
17:26
resend0 cleaned at connect check-in: 217298f0da user: bernd tags: trunk
17:06
minimum blocksize check-in: e4211e87dc user: bernd tags: trunk
2020-02-02
16:02
Fix xlat464 initialization problem check-in: 16ee7bd49e user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to connected.fs.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
    o IF  o elit, :>dispose-context  true to closing?  THEN ;
+net2o: set-ip ( $:string -- ) \g set address information
    $> setip-xt ;
+net2o: get-ip ( -- ) \g request address information
    >sockaddr $, set-ip [: $, set-ip ;] n2oaddrs ;

+net2o: set-blocksize ( n -- ) \g set blocksize to 2^n
    64>n 1 swap max-block# umin lshift net2o:blocksizes! ;
+net2o: set-blockalign ( n -- ) \g set block alignment to 2^n
    64>n 1 swap max-block# umin lshift blockalign ! ;
+net2o: close-all ( -- ) \g close all files
    net2o:close-all ;
\ better slurping

+net2o: set-top ( utop flag -- ) \g set top, flag is true when all data is sent
    >r 64>n r> data-rmap with mapc
	over dest-top <> and false dest-end ?!@ drop \ atomic, replaces or!
................................................................................
	error-id>o ?dup-IF
	    >o <event elit, :>throw wait-task @ event> o>
	ELSE  throw  THEN
    THEN ; IS >throw

also }scope

: blocksize! ( n -- )  max-block# umin dup ulit, set-blocksize
    1 swap lshift net2o:blocksizes! ;
: blockalign! ( n -- ) max-block# umin dup ulit, set-blockalign
    1 swap lshift blockalign ! ;

: open-sized-file ( addr u mode --)
    open-file get-size ;
: open-tracked-file ( addr u mode --)
    open-sized-file get-stat ;








|

|







 







|

|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
    o IF  o elit, :>dispose-context  true to closing?  THEN ;
+net2o: set-ip ( $:string -- ) \g set address information
    $> setip-xt ;
+net2o: get-ip ( -- ) \g request address information
    >sockaddr $, set-ip [: $, set-ip ;] n2oaddrs ;

+net2o: set-blocksize ( n -- ) \g set blocksize to 2^n
    64>n 1 swap min-block# umax max-block# umin lshift net2o:blocksizes! ;
+net2o: set-blockalign ( n -- ) \g set block alignment to 2^n
    64>n 1 swap min-block# umax max-block# umin lshift blockalign ! ;
+net2o: close-all ( -- ) \g close all files
    net2o:close-all ;
\ better slurping

+net2o: set-top ( utop flag -- ) \g set top, flag is true when all data is sent
    >r 64>n r> data-rmap with mapc
	over dest-top <> and false dest-end ?!@ drop \ atomic, replaces or!
................................................................................
	error-id>o ?dup-IF
	    >o <event elit, :>throw wait-task @ event> o>
	ELSE  throw  THEN
    THEN ; IS >throw

also }scope

: blocksize! ( n -- )  min-block# umax max-block# umin dup ulit, set-blocksize
    1 swap lshift net2o:blocksizes! ;
: blockalign! ( n -- ) min-block# umax max-block# umin dup ulit, set-blockalign
    1 swap lshift blockalign ! ;

: open-sized-file ( addr u mode --)
    open-file get-size ;
: open-tracked-file ( addr u mode --)
    open-sized-file get-stat ;

Changes to msg.fs.

2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
    1 key dup bl < >r lshift r> and ;

: wait-key ( -- )
    BEGIN  key-ctrlbit [ 1 ctrl L lshift 1 ctrl Z lshift or ]L
    and 0=  UNTIL ;

: chats# ( -- n )
    0 [: msg:peers[] $[]# 1 max + ;] group#map ;

: wait-chat ( -- )
    chat-keys [: @/2 dup 0= IF  2drop  EXIT  THEN
      2dup keysize2 safe/string tuck <info> type IF '.' emit  THEN
      .key-id space ;] $[]map
    ." is not online. press key to recheck."
    [: 0 to connection -56 throw ;] is do-disconnect







|







2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
    1 key dup bl < >r lshift r> and ;

: wait-key ( -- )
    BEGIN  key-ctrlbit [ 1 ctrl L lshift 1 ctrl Z lshift or ]L
    and 0=  UNTIL ;

: chats# ( -- n )
    0 [: msg:peers[] $[]# 1 min + ;] group#map ;

: wait-chat ( -- )
    chat-keys [: @/2 dup 0= IF  2drop  EXIT  THEN
      2dup keysize2 safe/string tuck <info> type IF '.' emit  THEN
      .key-id space ;] $[]map
    ." is not online. press key to recheck."
    [: 0 to connection -56 throw ;] is do-disconnect

Changes to net2o.fs.

60
61
62
63
64
65
66

67
68
69
70
71
72
73

\ values, configurable

$4 Value max-size^2 \ 1k, don't fragment by default
$12 Value max-data# \ 16MB data space
$0C Value max-code# \ 256k code space
$10 Value max-block# \ 64k maximum block size+alignment


\ values, status

true Value connected?
0 Value dht-connection

\ constants, and depending values







>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

\ values, configurable

$4 Value max-size^2 \ 1k, don't fragment by default
$12 Value max-data# \ 16MB data space
$0C Value max-code# \ 256k code space
$10 Value max-block# \ 64k maximum block size+alignment
$0C Value min-block# \ 4k minimum block size

\ values, status

true Value connected?
0 Value dht-connection

\ constants, and depending values

Changes to socks.fs.

99
100
101
102
103
104
105

106
107

108
109
110
111
112
113
114
	THEN
    THEN ;

: send-a-packet ( addr u -- n ) +calc
    droprate# IF  rng32 droprate# u< IF
	    resend( ." dropping packet" cr )
	    1 packets +! 2drop 0  EXIT  THEN  THEN

    2>r net2o-sock 2r> 0 sockaddr> alen @ sendto +send 1 packets +!
    sendto( ." send to: " sockaddr> alen @ .address space dup . cr ) ;


\ clients routing table

: init-route ( -- )  s" " routes# hash@ $! ; \ field 0 is me, myself

: ipv4>ipv6 ( addr u dest -- addr' u' )
    >r drop







>

|
>







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
	THEN
    THEN ;

: send-a-packet ( addr u -- n ) +calc
    droprate# IF  rng32 droprate# u< IF
	    resend( ." dropping packet" cr )
	    1 packets +! 2drop 0  EXIT  THEN  THEN
    sendto( over >r )
    2>r net2o-sock 2r> 0 sockaddr> alen @ sendto +send 1 packets +!
    sendto( ." send to: " sockaddr> alen @ .address space dup .
    r> mapaddr 64@ x64. cr ) ;

\ clients routing table

: init-route ( -- )  s" " routes# hash@ $! ; \ field 0 is me, myself

: ipv4>ipv6 ( addr u dest -- addr' u' )
    >r drop