Commit 5d6b1764 authored by Bernd Paysan's avatar Bernd Paysan

minimum blocksize

parent 0493c464
......@@ -35,9 +35,9 @@ connect-table $@ inherit-table context-table
>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! ;
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 max-block# umin lshift blockalign ! ;
64>n 1 swap min-block# umax max-block# umin lshift blockalign ! ;
+net2o: close-all ( -- ) \g close all files
net2o:close-all ;
\ better slurping
......@@ -195,9 +195,9 @@ in net2o : gen-reset ( -- )
also }scope
: blocksize! ( n -- ) max-block# umin dup ulit, set-blocksize
: blocksize! ( n -- ) min-block# umax max-block# umin dup ulit, set-blocksize
1 swap lshift net2o:blocksizes! ;
: blockalign! ( n -- ) max-block# umin dup ulit, set-blockalign
: blockalign! ( n -- ) min-block# umax max-block# umin dup ulit, set-blockalign
1 swap lshift blockalign ! ;
: open-sized-file ( addr u mode --)
......
......@@ -2021,7 +2021,7 @@ $B $E 2Value chat-bufs#
and 0= UNTIL ;
: chats# ( -- n )
0 [: msg:peers[] $[]# 1 max + ;] group#map ;
0 [: msg:peers[] $[]# 1 min + ;] group#map ;
: wait-chat ( -- )
chat-keys [: @/2 dup 0= IF 2drop EXIT THEN
......
......@@ -64,6 +64,7 @@ $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
......
......@@ -103,8 +103,10 @@ $00000000 Value droprate#
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 . cr ) ;
sendto( ." send to: " sockaddr> alen @ .address space dup .
r> mapaddr 64@ x64. cr ) ;
\ clients routing table
......
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