VirtualBox

Changeset 54662 in vbox for trunk/src


Ignore:
Timestamp:
Mar 6, 2015 5:29:44 AM (10 years ago)
Author:
vboxsync
Message:

Main/HostDnsService: instead of keeping fragile state g/c notifyAll()
and just notify proxy directly from setInfo() when info changed.

Location:
trunk/src/VBox/Main/src-server
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/HostDnsService.cpp

    r54631 r54662  
    8787{
    8888    Data(bool aThreaded) :
    89         fInfoModified(false),
    9089        fThreaded(aThreaded)
    9190    {}
     
    9392    std::vector<PCHostDnsMonitorProxy> proxies;
    9493    HostDnsInformation info;
    95     bool fInfoModified;
    9694    const bool fThreaded;
    9795    RTTHREAD hMonitoringThread;
     
    198196}
    199197
    200 void HostDnsMonitor::notifyAll() const
    201 {
    202     ALock l(this);
    203     if (m->fInfoModified)
    204     {
    205         m->fInfoModified = false;
    206         std::vector<PCHostDnsMonitorProxy>::const_iterator it;
    207         for (it = m->proxies.begin(); it != m->proxies.end(); ++it)
    208             (*it)->notify();
    209     }
    210 }
    211 
    212198void HostDnsMonitor::setInfo(const HostDnsInformation &info)
    213199{
    214200    ALock l(this);
    215     // Check for actual modifications, as the Windows specific code seems to
    216     // often set the same information as before, without any change to the
    217     // previous state. Here we have the previous state, so make sure we don't
    218     // ever tell our clients about unchanged info.
    219     if (!info.equals(m->info))
    220     {
    221         m->info = info;
    222         m->fInfoModified = true;
    223     }
     201
     202    if (info.equals(m->info))
     203        return;
     204
     205    m->info = info;
     206
     207    std::vector<PCHostDnsMonitorProxy>::const_iterator it;
     208    for (it = m->proxies.begin(); it != m->proxies.end(); ++it)
     209        (*it)->notify();
    224210}
    225211
  • trunk/src/VBox/Main/src-server/HostDnsService.h

    r54302 r54662  
    8484    virtual ~HostDnsMonitor();
    8585
    86     void notifyAll() const;
    8786    void setInfo(const HostDnsInformation &);
    8887
  • trunk/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp

    r53122 r54662  
    7979    ALock l(pThis);
    8080    pThis->updateInfo();
    81     pThis->notifyAll();
    8281}
    8382
  • trunk/src/VBox/Main/src-server/linux/HostDnsServiceLinux.cpp

    r52617 r54662  
    153153                {
    154154                    readResolvConf();
    155                     /* notifyAll() takes required locks */
    156                     notifyAll();
    157155                }
    158156                else if (combo.e.mask & IN_DELETE_SELF)
     
    214212                        /* Notify our listeners */
    215213                        readResolvConf();
    216                         notifyAll();
    217 
    218214                    }
    219215                }
  • trunk/src/VBox/Main/src-server/win/HostDnsServiceWin.cpp

    r53624 r54662  
    157157        {
    158158            updateInfo();
    159             notifyAll();
    160159
    161160            ResetEvent(m->haDataEvent[DATA_DNS_UPDATE_EVENT]);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette