• Thomas Haller's avatar
    core: add NMNetns to bundle platform and route managers · d37b9d79
    Thomas Haller authored
    NMPlatform, NMRouteManager and NMDefaultRouteManager are singletons
    instances. Users of those are for example NMDevice, which registers
    to GObject signals of both NMPlatform and NMRouteManager.
    
    Hence, as NMDevice:dispose() disconnects the signal handlers, it must
    ensure that those singleton instances live longer then the NMDevice
    instance. That is usually accomplished by having users of singleton
    instances own a reference to those instances.
    For NMDevice that effectively means that it shall own a reference to
    several singletons.
    
    NMPlatform, NMRouteManager, and NMDefaultRouteManager are all
    per-namespace. In general it doesn't make sense to have more then
    one instances of these per name space. Nnote that currently we don't
    support multiple namespaces yet. If we will ever support multiple
    namespaces, then a NMDevice would have a reference to all of these
    manager instances. Hence, introduce a new class NMNetns which bundles
    them together.
    
    (cherry picked from commit 0af2f5c2)
    d37b9d79
main.c 14.4 KB