Skip to content

Routers propagate pre-existing tokens to clients #2278

@fuzzypixelz

Description

@fuzzypixelz

Describe the bug

Zenoh should only push liveliness updates (i.e. token PUT/DELETE) when fresh information is available: liveliness subscribers without history should not receive a token PUT if the token already existed before the subscriber was declared.

When the broker is a peer, this property is upheld. But when the broker is a router it is broken.

To reproduce

#!/usr/bin/env nuze --experimental-options --no-default-session

def with-broker-mode [mode] {
    zenoh open -s a {id:a,mode:$mode,listen:{endpoints:[tcp/::1:9000]}}
    zenoh open -s c1 {id:c1,mode:client,connect:{endpoints:[tcp/::1:9000]}}
    zenoh open -s c2 {id:c2,mode:client,connect:{endpoints:[tcp/::1:9000]}}
    zenoh open -s c3 {id:c3,mode:client,connect:{endpoints:[tcp/::1:9000]}}
    sleep 100ms

    print "c1: declare token on x"
    let x1 = zenoh liveliness declare-token -s c1 x
    sleep 100ms

    job spawn {zenoh liveliness sub -s c2 x | each {|s| print $"c2: new token ($s.kind) on x"}}
    sleep 100ms

    print "c3: declare token on x"
    let x3 = zenoh liveliness declare-token -s c3 x
    sleep 100ms

    job list | each {|j| job kill $j.id}
    zenoh session list | each {|s| zenoh session close -s $s.name}
    null
}

with-broker-mode peer
# c1: declare token on x
# c3: declare token on x

with-broker-mode router
# c1: declare token on x
# c3: declare token on x
# c2: new token PUT on x

System info

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions