Check-in [7ad73e33fe]
Not logged in

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

Overview
Comment:Use new online? check
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7ad73e33fe37063204693bad3ae88398cc97e7cb
User & Date: bernd 2019-04-18 21:30:35.648
Context
2019-04-24
21:20
Check online status check-in: bb3039ab0a user: bernd tags: trunk
2019-04-18
21:30
Use new online? check check-in: 7ad73e33fe user: bernd tags: trunk
21:17
Check connected status in dhtroot check-in: 271f857838 user: bernd tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to helper.fs.
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

: +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 +dht-beacon
    pk:connect  o to dht-connection ;
: 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 ;







|
|







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

: +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 ;
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
    [IFDEF] PF_NETLINK  require linux/net.fs    [THEN]
[THEN]

\ announce and renat

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

: 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>







|







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
    [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>
245
246
247
248
249
250
251
252

253
254
255
256
257
258
259
	2dup d0<> WHILE
	    over c@ '!' = WHILE
		replace-key o>
		connect( >o ke-pk $@ ." replace key: " 2dup 85type cr o o> )
		>r 2dup c:fetch-id r> >o  REPEAT  THEN  d0<> ;

: pk-query ( addr u xt -- flag ) >r
    dht-connect  2dup r> execute  replace-loop ;


: pk-lookup ( addr u -- )
    ['] pk:fetch-host  ['] pk:addme-fetch-host  announced @ select
    pk-query 0= !!host-notfound!! ;

: pk-peek? ( pk u -- flag )  ['] pk:fetch-host pk-query ;








|
>







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
	2dup d0<> WHILE
	    over c@ '!' = WHILE
		replace-key o>
		connect( >o ke-pk $@ ." replace key: " 2dup 85type cr o o> )
		>r 2dup c:fetch-id r> >o  REPEAT  THEN  d0<> ;

: pk-query ( addr u xt -- flag ) >r
    dht-connect online? IF  2dup r> execute  replace-loop
    ELSE  2drop rdrop false  THEN ;

: pk-lookup ( addr u -- )
    ['] pk:fetch-host  ['] pk:addme-fetch-host  announced @ select
    pk-query 0= !!host-notfound!! ;

: pk-peek? ( pk u -- flag )  ['] pk:fetch-host pk-query ;