diff --git a/os2.rkt b/os2.rkt index 6d17786..7a606a9 100644 --- a/os2.rkt +++ b/os2.rkt @@ -144,6 +144,14 @@ (and (roles-intersect? (topic-role left) (topic-role right)) (mgu-canonical (freshen (topic-pattern left)) (freshen (topic-pattern right))))) +;; True iff the flow between remote-topic and local-topic should be +;; visible to the local peer. This is the case when either local-topic +;; is virtual (in which case everything is seen) or otherwise if +;; remote-topic is also not virtual. +(define (flow-visible? local-topic remote-topic) + (or (topic-virtual? local-topic) + (not (topic-virtual? remote-topic)))) + ;;--------------------------------------------------------------------------- ;; QuasiQueue @@ -216,16 +224,20 @@ #:when flow-pattern) (define inbound-flow (refine-topic matching-topic flow-pattern)) (define outbound-flow (refine-topic topic flow-pattern)) - (let* ((state (run-trapk state - pid - (handlers-presence hs) - new-eid - inbound-flow)) - (state (run-trapk state - matching-pid - (handlers-presence (endpoint-handlers e)) - matching-eid - outbound-flow))) + (let* ((state (if (flow-visible? topic inbound-flow) + (run-trapk state + pid + (handlers-presence hs) + new-eid + inbound-flow) + state)) + (state (if (flow-visible? matching-topic outbound-flow) + (run-trapk state + matching-pid + (handlers-presence (endpoint-handlers e)) + matching-eid + outbound-flow) + state))) state)) [processes (hash-set (vm-processes state) pid