Check-in [cfc7fe3d19]
Not logged in

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

Overview
Comment:Fix for bugs Martin detected yesterday
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cfc7fe3d1988cffe65c3429f96c66f3641197d46
User & Date: bernd 2019-04-26 19:12:06
Context
2019-04-30
22:23
Add dummies for future expansion of pubkey format check-in: 528007f864 user: bernd tags: trunk
2019-04-26
19:12
Fix for bugs Martin detected yesterday check-in: cfc7fe3d19 user: bernd tags: trunk
15:52
add dummy for 64^ local check-in: da93028df9 user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to cmd.fs.

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
: n>cmd ( n -- addr ) cells >r
    o IF  token-table  ELSE  setup-table  THEN
    $@ r@ u<= !!function!! r> + ;

: cmd@ ( -- u ) buf-state 2@ over + >r p@+ r> over - buf-state 2! 64>n ;

standard:field
-7 dup 1 and cell 4 = and - cells 0 +field net2o.name
drop

: >net2o-name ( addr -- addr' u )
    net2o.name body> name>string ;
: >net2o-sig ( addr -- addr' u )
    net2o.name 3 cells + $@ ;
: .net2o-num ( off -- )  cell/ '<' emit 0 .r '>' emit space ;







|







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
: n>cmd ( n -- addr ) cells >r
    o IF  token-table  ELSE  setup-table  THEN
    $@ r@ u<= !!function!! r> + ;

: cmd@ ( -- u ) buf-state 2@ over + >r p@+ r> over - buf-state 2! 64>n ;

standard:field
-7 cells 0 +field net2o.name
drop

: >net2o-name ( addr -- addr' u )
    net2o.name body> name>string ;
: >net2o-sig ( addr -- addr' u )
    net2o.name 3 cells + $@ ;
: .net2o-num ( off -- )  cell/ '<' emit 0 .r '>' emit space ;

Changes to helper.fs.

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
    connect( [: .time ." Connect to: " dup hex. cr ;] $err )
    net2o:new-context >o rdrop o to connection  setup!
    dest-pk \ set our destination key
    +resend-cmd net2o:connect
    +flow-control +resend
    connect( [: .time ." Connected, o=" o hex. cr ;] $err ) ;

0 Value dht-connection

Forward renat-all

event: :>renat ( -- )  renat-all ;
event: :>disconnect ( addr -- )  .disconnect-me ;
: dht-beacon ( addr u -- )
    <event :>renat main-up@ event> 2drop ;

................................................................................
	      THEN
	  cell +LOOP o>
      cell +LOOP
    ;] #map ;

\ notification for address changes

true Value connected?

[IFDEF] android     require android/net.fs  [ELSE]
    [IFDEF] PF_NETLINK  require linux/net.fs    [THEN]
[THEN]

\ announce and renat

: announce-me ( -- )







<
<







 







<
<







68
69
70
71
72
73
74


75
76
77
78
79
80
81
...
133
134
135
136
137
138
139


140
141
142
143
144
145
146
    connect( [: .time ." Connect to: " dup hex. cr ;] $err )
    net2o:new-context >o rdrop o to connection  setup!
    dest-pk \ set our destination key
    +resend-cmd net2o:connect
    +flow-control +resend
    connect( [: .time ." Connected, o=" o hex. cr ;] $err ) ;



Forward renat-all

event: :>renat ( -- )  renat-all ;
event: :>disconnect ( addr -- )  .disconnect-me ;
: dht-beacon ( addr u -- )
    <event :>renat main-up@ event> 2drop ;

................................................................................
	      THEN
	  cell +LOOP o>
      cell +LOOP
    ;] #map ;

\ notification for address changes



[IFDEF] android     require android/net.fs  [ELSE]
    [IFDEF] PF_NETLINK  require linux/net.fs    [THEN]
[THEN]

\ announce and renat

: announce-me ( -- )

Changes to keys.fs.

451
452
453
454
455
456
457


458
459
460
461
462
463
464
465
466

467
468


469

470
471
472
473
474
475
476

: .key# ( addr u -- ) key|
    ." Key '" key# #@ 0= IF drop EXIT THEN
    cell+ ..nick ." ' ok" cr ;

Forward dht-nick?
Variable keysearchs#


event: :>search-key ( $addr -- )
    { w^ key } key $@ dht-nick? key $free
    1 keysearchs# +!@ drop ;

: .unkey-id ( addr u -- ) <err> 8 umin 85type ." (unknown)" <default>
    [ 1 import#untrusted lshift ]L to last-ki ;

: .key-id ( addr u -- )  last# >r  key| 2dup key# #@ 0=
    IF  drop keysearchs# @ 1+ >r

	<event 2dup $make elit, :>search-key ?query-task event|
	BEGIN  keysearchs# @ r@ - 0<  WHILE  <event  query-task event|  REPEAT


	rdrop  2dup key# #@ 0= IF  drop .unkey-id  r> to last# EXIT  THEN

    THEN
    cell+ ..nick 2drop r> to last# ;

: .key-id? ( addr u -- )  last# >r  key| 2dup key# #@ 0=
    IF  drop .unkey-id  r> to last# EXIT  THEN
    cell+ ..nick 2drop r> to last# ;








>
>









>
|
|
>
>
|
>







451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482

: .key# ( addr u -- ) key|
    ." Key '" key# #@ 0= IF drop EXIT THEN
    cell+ ..nick ." ' ok" cr ;

Forward dht-nick?
Variable keysearchs#
hash: unknown-keys#

event: :>search-key ( $addr -- )
    { w^ key } key $@ dht-nick? key $free
    1 keysearchs# +!@ drop ;

: .unkey-id ( addr u -- ) <err> 8 umin 85type ." (unknown)" <default>
    [ 1 import#untrusted lshift ]L to last-ki ;

: .key-id ( addr u -- )  last# >r  key| 2dup key# #@ 0=
    IF  drop keysearchs# @ 1+ >r
	2dup unknown-keys# #@ nip 0= dht-connection and IF
	    <event 2dup $make elit, :>search-key ?query-task event|
	    BEGIN  keysearchs# @ r@ - 0<  WHILE  <event  query-task event|  REPEAT
	    rdrop  2dup key# #@ 0= IF  drop
		"<unknown>" 2over unknown-keys# #!
		.unkey-id  r> to last# EXIT  THEN
	ELSE  rdrop .unkey-id  r> to last#  EXIT  THEN
    THEN
    cell+ ..nick 2drop r> to last# ;

: .key-id? ( addr u -- )  last# >r  key| 2dup key# #@ 0=
    IF  drop .unkey-id  r> to last# EXIT  THEN
    cell+ ..nick 2drop r> to last# ;

Changes to msg.fs.

1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
: /otrify ( addr u -- )
    \U otrify #line[s]      otrify message
    \G otrify: turn an older message of yours into an OTR message
    true otr-mode [: now>otr
	[: BEGIN  bl $split 2>r dup  WHILE  s>unumber? WHILE
			drop do-otrify  2r>  REPEAT THEN
	    2drop 2r> 2drop
	;] (send-avalanche) drop .chat
    ;] !wrapper ;

: /bye ( addr u -- )
    \U bye
    \G bye: leaves the current chat
    2drop -1 [IFDEF] android android:level# [ELSE] level# [THEN] +! ;
}scope







|







1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
: /otrify ( addr u -- )
    \U otrify #line[s]      otrify message
    \G otrify: turn an older message of yours into an OTR message
    true otr-mode [: now>otr
	[: BEGIN  bl $split 2>r dup  WHILE  s>unumber? WHILE
			drop do-otrify  2r>  REPEAT THEN
	    2drop 2r> 2drop
	;] (send-avalanche) drop .chat save-msgs&
    ;] !wrapper ;

: /bye ( addr u -- )
    \U bye
    \G bye: leaves the current chat
    2drop -1 [IFDEF] android android:level# [ELSE] level# [THEN] +! ;
}scope

Changes to net2o.fs.

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






\ constants, and depending values

$2A Constant overhead \ constant overhead
$40 Constant min-size
1 Value buffers#
min-size max-size^2 lshift Value maxdata ( -- n )
maxdata overhead + Value maxpacket







>
>
>
>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
\ 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

$2A Constant overhead \ constant overhead
$40 Constant min-size
1 Value buffers#
min-size max-size^2 lshift Value maxdata ( -- n )
maxdata overhead + Value maxpacket