Check-in [11076b178e]
Not logged in

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

Overview
Comment:Fix off-by-one sync problem
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 11076b178ebe084b32e03919c11c736c2198205a
User & Date: bernd 2016-08-18 13:08:49
Context
2016-08-18
13:48
Bump version number check-in: 1b704982af user: bernd tags: trunk, 0.1.7-20160818
13:08
Fix off-by-one sync problem check-in: 11076b178e user: bernd tags: trunk
2016-08-17
23:51
Better syncing check-in: 55b63763a0 user: bernd tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to net2o-file.fs.

235
236
237
238
239
240
241
242
243
244
245
246
247
248
249

event: ->termfile ( o -- ) dup termfile ! >o form term-w ! term-h ! o>
    termserver-in termserver-out ;
event: ->termclose ( -- ) termfile off  default-in default-out ;

:noname ( addr u -- u )
    fs-limit 64@ 64>n fs-inbuf $@len - min  tuck fs-inbuf $+!
    fs-size 64@ fs-inbuf $@len u>64 64= IF
	<event o elit, ->file-done parent @ .wait-task @ event>
    THEN ; termserver-class to fs-write
:noname ( addr u -- u ) fs-outbuf $@len umin >r
    fs-outbuf $@ r@ umin rot swap move
    fs-outbuf 0 r@ $del r> ; termserver-class to fs-read
:noname ( addr u 64n -- )  64drop 2drop
    [: termserver-tasks $@ 0= !!no-termserver!!







|







235
236
237
238
239
240
241
242
243
244
245
246
247
248
249

event: ->termfile ( o -- ) dup termfile ! >o form term-w ! term-h ! o>
    termserver-in termserver-out ;
event: ->termclose ( -- ) termfile off  default-in default-out ;

:noname ( addr u -- u )
    fs-limit 64@ 64>n fs-inbuf $@len - min  tuck fs-inbuf $+!
    fs-size 64@ fs-inbuf $@len u>64 64= fs-inbuf $@len 0<> and IF
	<event o elit, ->file-done parent @ .wait-task @ event>
    THEN ; termserver-class to fs-write
:noname ( addr u -- u ) fs-outbuf $@len umin >r
    fs-outbuf $@ r@ umin rot swap move
    fs-outbuf 0 r@ $del r> ; termserver-class to fs-read
:noname ( addr u 64n -- )  64drop 2drop
    [: termserver-tasks $@ 0= !!no-termserver!!

Changes to net2o-msg.fs.

473
474
475
476
477
478
479
480

481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
...
508
509
510
511
512
513
514

515
516
517
518
519
520
521

:noname ( -- 64len )
    \ poll serializes the 
    fs-outbuf $off
    fs-path $@ 2 64s /string ?msg-log
    last# msg-log@ over >r
    fs-path $@ drop le-64@ last# cell+ $search[]date \ start index
    fs-path $@ drop 64'+ le-64@ last# cell+ $search[]date over - >r

    cells safe/string r> cells umin
    req? @ >r req? off  serialize-log   r> req? !  fs-outbuf $!buf
    r> free throw
    fs-outbuf $@len u>64 ; msgfs-class is fs-poll
:noname ( addr u mode -- )
    \G addr u is starttick endtick name concatenated together
    fs-close  drop fs-path $!  fs-poll fs-size!
; msgfs-class is fs-open
: msg-file-done ( -- )
    fs-close parent @ >o
    -1 file-count +!
    file-count @ 0< IF  file-count off
    ELSE  file-count @ 0= IF
	    ." === sync done ===" forth:cr
	    file-reg# off  file-count off
	    msg-group$ $@ ?msg-log last# cell+ $[]#
	    sync-date 64@ date>i 1+ - 0 max
	    ?dup-IF  last# $@ rot  display-lastn  THEN
................................................................................
:noname ( -- )
    fs-path @ 0= ?EXIT
    fs-path $@ 2 64s /string >group
    replay-mode @ >r replay-mode on
    fs-inbuf $@ dup IF  msg-eval  ELSE  2drop  THEN  fs-inbuf $off
    r> replay-mode !
    fs-path $off

; msgfs-class is fs-close
:noname ( perm -- )
    perm%msg and 0= !!msg-perm!!
; msgfs-class to fs-perm?
:noname ( -- date perm )
    64#0 0 ; msgfs-class is fs-get-stat
:noname ( date perm -- )







|
>










<







 







>







473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491

492
493
494
495
496
497
498
...
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522

:noname ( -- 64len )
    \ poll serializes the 
    fs-outbuf $off
    fs-path $@ 2 64s /string ?msg-log
    last# msg-log@ over >r
    fs-path $@ drop le-64@ last# cell+ $search[]date \ start index
    fs-path $@ drop 64'+ le-64@ last# cell+ $search[]date 1+ \ end index
    last# cell+ $[]# 1- umin over - >r
    cells safe/string r> cells umin
    req? @ >r req? off  serialize-log   r> req? !  fs-outbuf $!buf
    r> free throw
    fs-outbuf $@len u>64 ; msgfs-class is fs-poll
:noname ( addr u mode -- )
    \G addr u is starttick endtick name concatenated together
    fs-close  drop fs-path $!  fs-poll fs-size!
; msgfs-class is fs-open
: msg-file-done ( -- )
    fs-close parent @ >o

    file-count @ 0< IF  file-count off
    ELSE  file-count @ 0= IF
	    ." === sync done ===" forth:cr
	    file-reg# off  file-count off
	    msg-group$ $@ ?msg-log last# cell+ $[]#
	    sync-date 64@ date>i 1+ - 0 max
	    ?dup-IF  last# $@ rot  display-lastn  THEN
................................................................................
:noname ( -- )
    fs-path @ 0= ?EXIT
    fs-path $@ 2 64s /string >group
    replay-mode @ >r replay-mode on
    fs-inbuf $@ dup IF  msg-eval  ELSE  2drop  THEN  fs-inbuf $off
    r> replay-mode !
    fs-path $off
    -1 parent @ .file-count +!
; msgfs-class is fs-close
:noname ( perm -- )
    perm%msg and 0= !!msg-perm!!
; msgfs-class to fs-perm?
:noname ( -- date perm )
    64#0 0 ; msgfs-class is fs-get-stat
:noname ( date perm -- )