Support three levels of interest-type for a topic: participant/ordinary, monitor/observer, and "super-monitor".

This commit is contained in:
Tony Garnock-Jones 2012-07-04 17:15:11 -04:00
parent 28cc220010
commit a0c60fd8db
2 changed files with 5 additions and 20 deletions

View File

@ -34,14 +34,7 @@
[(topic 'publisher (tcp-channel remote-addr (== server-addr) _) #f) [(topic 'publisher (tcp-channel remote-addr (== server-addr) _) #f)
(transition state (transition state
(spawn (session-vm server-addr remote-addr) (spawn (session-vm server-addr remote-addr)
#:debug-name (list 'ssh-session-vm remote-addr)))] #:debug-name (list 'ssh-session-vm remote-addr)))]))))
;; PAPER NOTE: This second clause can be replaced with
;; [_ state] for presentation economy
[(topic 'publisher (tcp-channel remote-addr (== server-addr) _) #t)
;; Ignore monitor flows. They just mean there's
;; someone willing to supply connections to us
;; at some point in the future.
state]))))
;;--------------------------------------------------------------------------- ;;---------------------------------------------------------------------------
@ -67,16 +60,12 @@
(flush-output) (flush-output)
state]) state])
(at-meta-level (at-meta-level
(role 'channel-listener (topic-subscriber (channel-message (channel-stream-name #t (wild)) (role 'channel-listener (topic-subscriber (channel-message (channel-stream-name #t (wild)) (wild)))
(wild)))
#:state state #:state state
#:topic t #:topic t
#:on-presence #:on-presence (match t
(if (topic-monitor? t) [(topic _ (channel-message (channel-stream-name _ cname) _) _)
state (transition state (spawn (repl-instance cname) #:debug-name cname))])))))
(match t
[(topic _ (channel-message (channel-stream-name _ cname) _) _)
(transition state (spawn (repl-instance cname) #:debug-name cname))]))))))
(define (repl-instance cname) (define (repl-instance cname)
(define inbound-stream (channel-stream-name #t cname)) (define inbound-stream (channel-stream-name #t cname))

View File

@ -687,10 +687,6 @@
#:topic t #:topic t
#:on-presence #:on-presence
(match t (match t
[(topic _ _ #t)
;; Monitor topics appearing indicate receptivity to incoming
;; channels, and are nothing to do with outgoing channels.
conn]
[(or (topic 'publisher (channel-message (channel-stream-name #f cname) _) #f) [(or (topic 'publisher (channel-message (channel-stream-name #f cname) _) #f)
(topic 'subscriber (channel-message (channel-stream-name #t cname) _) #f)) (topic 'subscriber (channel-message (channel-stream-name #t cname) _) #f))
(if (and (ground? cname) (if (and (ground? cname)