Check-in [e0382ae3c9]
Not logged in

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

Overview
Comment:Partial fix for the /renat problem
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e0382ae3c95a7ffe31dc0c4d56e72f44526f0b4e
User & Date: bernd 2019-07-07 20:57:09.576
Context
2019-07-08
18:32
Fix problem with insert-address check-in: 856357a817 user: bernd tags: trunk
2019-07-07
20:57
Partial fix for the /renat problem check-in: e0382ae3c9 user: bernd tags: trunk
2019-07-05
22:14
Saving away in Chinese check-in: 9e33f84c70 user: bernd tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to debugging.fs.
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
	: lastxt ]]L last-exe-xt ! [[ ;
[ELSE]
    : .exe ;
[THEN]

\ more phony throw stuff, only for debugging engine

debugging-method [defined] record-locs and [IF] record-locs [THEN]
debugging-method drop false [IF]
:noname  ." Store backtrace..." cr defers store-backtrace
    dobacktrace ; is store-backtrace

:noname  ?dup-IF  ." Throw directly " dup . cr dobacktrace
	defers throw  THEN ; is throw
[THEN]







<







203
204
205
206
207
208
209

210
211
212
213
214
215
216
	: lastxt ]]L last-exe-xt ! [[ ;
[ELSE]
    : .exe ;
[THEN]

\ more phony throw stuff, only for debugging engine


debugging-method drop false [IF]
:noname  ." Store backtrace..." cr defers store-backtrace
    dobacktrace ; is store-backtrace

:noname  ?dup-IF  ." Throw directly " dup . cr dobacktrace
	defers throw  THEN ; is throw
[THEN]
Changes to helper.fs.
82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97
98
99
: +dht-beacon ( -- )
    beacons# @ 0= IF  ret-addr be@ ['] dht-beacon 0 .add-beacon  THEN ;

: dht-connect ( -- )
    dht-connection ?dup-IF  >o o to connection rdrop  EXIT  THEN
    tick-adjust 64@ 64-0= IF  +get-time  THEN
    $8 $8 dhtnick $@ nick>pk dhtroot
    online? IF  +dht-beacon pk:connect  o to dht-connection  THEN ;

: dht-disconnect ( -- )
    0 addr dht-connection !@  ?dup-IF
	>o o to connection disconnect-me o>  THEN ;

Variable announced
: subme ( -- )  announced @ IF
	dht-connect sub-me THEN ;

: c:disconnect ( -- ) connect( [: ." Disconnecting..." cr ;] $err )
    disconnect-me connect( [: .packets profile( .times ) ;] $err ) ;







|
>

|
|







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
: +dht-beacon ( -- )
    beacons# @ 0= IF  ret-addr be@ ['] dht-beacon 0 .add-beacon  THEN ;

: dht-connect ( -- )
    dht-connection ?dup-IF  >o o to connection rdrop  EXIT  THEN
    tick-adjust 64@ 64-0= IF  +get-time  THEN
    $8 $8 dhtnick $@ nick>pk dhtroot
    online? IF  +dht-beacon pk:connect  o to dht-connection
    ELSE  2drop 2drop  THEN ;
: dht-disconnect ( -- )
    0 addr dht-connection !@ ?dup-IF
	>o o to connection disconnect-me 0 to connection o>  THEN ;

Variable announced
: subme ( -- )  announced @ IF
	dht-connect sub-me THEN ;

: c:disconnect ( -- ) connect( [: ." Disconnecting..." cr ;] $err )
    disconnect-me connect( [: .packets profile( .times ) ;] $err ) ;
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154
    [IFDEF] PF_NETLINK  require linux/net.fs    [THEN]
[THEN]

\ announce and renat

: announce-me ( -- )
    \ Check for disconnected state
    dht-connect online? IF  replace-me -other  announced on  THEN ;


: renat-all ( -- ) beacon( ." remove all beacons" cr )
    [IFDEF] renat-complete [: [THEN]
	0 .!my-addr dht-disconnect \ old DHT may be stale
	announce-me \ if we succeed here, we can try the rest
	beacons# #frees
	0 >o dhtroot +dht-beacon o>







|
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
    [IFDEF] PF_NETLINK  require linux/net.fs    [THEN]
[THEN]

\ announce and renat

: announce-me ( -- )
    \ Check for disconnected state
    dht-connect online? IF
	replace-me -other  announced on  THEN ;

: renat-all ( -- ) beacon( ." remove all beacons" cr )
    [IFDEF] renat-complete [: [THEN]
	0 .!my-addr dht-disconnect \ old DHT may be stale
	announce-me \ if we succeed here, we can try the rest
	beacons# #frees
	0 >o dhtroot +dht-beacon o>
Changes to socks.fs.
142
143
144
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
: insert-address ( addr u -- net2o-addr ) ?<ipv6
    address( ." Insert address " 2dup .address cr )
    lastaddr# IF  2dup lastaddr# $@ str=
	IF  2drop lastn2oaddr @ EXIT  THEN
    THEN
    2dup routes# #key dup -1 = IF
	drop s" " 2over routes# #!
	last# to lastaddr#
	routes# #key  dup lastn2oaddr !
    ELSE
	nip nip
    THEN ;


: dns>string ( addr u port hint -- info net2o-addr u )
    >r SOCK_DGRAM >hints r> hints ai_family l!
    get-info dup info>string ;

: insert-ip* ( addr u port hint -- net2o-addr )
    dns>string rot >r insert-address r> freeaddrinfo ;







<



|
>







142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157
158
159
160
: insert-address ( addr u -- net2o-addr ) ?<ipv6
    address( ." Insert address " 2dup .address cr )
    lastaddr# IF  2dup lastaddr# $@ str=
	IF  2drop lastn2oaddr @ EXIT  THEN
    THEN
    2dup routes# #key dup -1 = IF
	drop s" " 2over routes# #!

	routes# #key  dup lastn2oaddr !
    ELSE
	nip nip
    THEN
    last# to lastaddr# ;

: dns>string ( addr u port hint -- info net2o-addr u )
    >r SOCK_DGRAM >hints r> hints ai_family l!
    get-info dup info>string ;

: insert-ip* ( addr u port hint -- net2o-addr )
    dns>string rot >r insert-address r> freeaddrinfo ;