VirtualBox

Changeset 54302 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Feb 19, 2015 4:53:56 PM (10 years ago)
Author:
vboxsync
Message:

Main/src-server/HostDnsService.cpp: make sure that only actual information changes trigger notifications, as the Windows backend likes to call HostDnsService::notifyAll when nothing changed

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

Legend:

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

    r53123 r54302  
    55
    66/*
    7  * Copyright (C) 2013-2014 Oracle Corporation
     7 * Copyright (C) 2013-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6666}
    6767
     68/* HostDnsInformation */
     69
     70bool HostDnsInformation::equals(const HostDnsInformation &info) const
     71{
     72    return    (servers == info.servers)
     73           && (domain == info.domain)
     74           && (searchList == info.searchList);
     75}
     76
    6877inline static void detachVectorOfString(const std::vector<std::string>& v,
    6978                                        std::vector<com::Utf8Str> &aArray)
     
    7786struct HostDnsMonitor::Data
    7887{
    79     Data(bool aThreaded):fThreaded(aThreaded){}
     88    Data(bool aThreaded) :
     89        fInfoModified(false),
     90        fThreaded(aThreaded)
     91    {}
    8092
    8193    std::vector<PCHostDnsMonitorProxy> proxies;
    8294    HostDnsInformation info;
     95    bool fInfoModified;
    8396    const bool fThreaded;
    8497    RTTHREAD hMonitoringThread;
     
    188201{
    189202    ALock l(this);
    190     std::vector<PCHostDnsMonitorProxy>::const_iterator it;
    191     for (it = m->proxies.begin(); it != m->proxies.end(); ++it)
    192         (*it)->notify();
     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    }
    193210}
    194211
     
    196213{
    197214    ALock l(this);
    198     m->info = info;
     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    }
    199224}
    200225
  • trunk/src/VBox/Main/src-server/HostDnsService.h

    r53165 r54302  
    6060    std::string domain;
    6161    std::vector<std::string> searchList;
     62    bool equals(const HostDnsInformation &) const;
    6263};
    6364
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