2016-04-01 23:53:46 +00:00
|
|
|
#lang syndicate-monolithic
|
2016-02-08 00:32:38 +00:00
|
|
|
;; Test case for a historical bug in Syndicate.
|
2016-02-07 21:14:12 +00:00
|
|
|
;;
|
2016-02-08 00:32:38 +00:00
|
|
|
;; When the bug existed, this program receiveed four SCN events in
|
2016-02-07 21:14:12 +00:00
|
|
|
;; total, whereas it should receive only two.
|
|
|
|
;;
|
2016-02-08 00:32:38 +00:00
|
|
|
;; While metamessages were "echo cancelled", and receivers only ever
|
|
|
|
;; got one copy of a sent metamessage no matter how many metas there
|
|
|
|
;; were, state changes were not. Issuing a quick enough "pulse" of
|
|
|
|
;; metaassertion while maintaining interest in it led to an "echo":
|
2016-02-07 21:14:12 +00:00
|
|
|
;; multiple receipts of the pulse.
|
|
|
|
;;
|
2016-02-08 00:32:38 +00:00
|
|
|
;; The fix was to adjust the implementation of state change
|
2016-02-07 21:14:12 +00:00
|
|
|
;; notifications to cancel the echo for metaassertions.
|
|
|
|
|
2016-04-01 23:53:46 +00:00
|
|
|
(require syndicate/pretty)
|
2016-02-07 21:14:12 +00:00
|
|
|
|
2016-04-07 07:42:54 +00:00
|
|
|
(spawn-dataspace
|
2016-02-07 21:14:12 +00:00
|
|
|
(spawn (lambda (e counter)
|
|
|
|
(and e
|
|
|
|
(let ((new-counter (+ counter 1)))
|
2016-04-01 23:53:46 +00:00
|
|
|
(printf "Received event ~a:\n~a\n" new-counter (syndicate-pretty-print->string e))
|
2016-02-07 21:14:12 +00:00
|
|
|
(transition (+ counter 1) '()))))
|
|
|
|
0
|
|
|
|
(list (scn/union (assertion (at-meta 'x))
|
|
|
|
(subscription 'x #:meta-level 1))
|
|
|
|
(scn (subscription 'x #:meta-level 1)))))
|