VirtualBox

Ignore:
Timestamp:
Oct 22, 2013 6:56:03 PM (11 years ago)
Author:
vboxsync
Message:

Main/HostDnsService: splits HostDnsService on "singleton" HostDnsMonitor
which monitors host changes and share DnsInformation to per HostImpl/VirtualBoxImpl objects
HostDnsMonitorProxy.

TODO: Win/Darwin parts might burn (not tested)
TODO: find good place to call HostDnsMonitor::shutdown() to stop
monitoring thread. (ref counting could be used on
HostDnsMonitor::addMonitorProxy and HostDnsMonitor::releaseMonitorProxy,
but it better to pausing monitoring on no --auto-shutdown launches of VBoxSVC).

File:
1 edited

Legend:

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

    r49201 r49235  
    2626#include <iprt/thread.h>
    2727
    28 #include "../HostDnsService.h"
    29 
    3028#include <errno.h>
    3129#include <poll.h>
     
    4038
    4139#include <string>
     40#include <vector>
     41#include "../HostDnsService.h"
     42
    4243
    4344static RTTHREAD g_DnsMonitoringThread;
     
    102103
    103104
     105HostDnsServiceLinux::~HostDnsServiceLinux()
     106{
     107    send(g_DnsMonitorStop[0], "", 1, 0);
     108}
     109
     110
    104111int HostDnsServiceLinux::hostMonitoringRoutine(RTTHREAD ThreadSelf, void *pvUser)
    105112{
     
    140147        if (polls[0].revents & POLLIN)
    141148        {
    142             RTCritSectEnter(&dns->::HostDnsService::m_hCritSect);
    143             dns->update();
    144             RTCritSectLeave(&dns->::HostDnsService::m_hCritSect);
     149            dns->readResolvConf();
     150            /* notifyAll() takes required locks */
     151            dns->notifyAll();
     152
    145153            polls[0].revents = 0;
    146154
     
    153161
    154162
    155 HRESULT HostDnsServiceLinux::init(const VirtualBox *aParent)
     163HRESULT HostDnsServiceLinux::init(const char *aResolvConfFileName)
    156164{
    157     HRESULT hrc = HostDnsServiceResolvConf::init(aParent);
     165    HRESULT hrc = HostDnsServiceResolvConf::init(aResolvConfFileName);
    158166    AssertComRCReturnRC(hrc);
    159167
     
    169177    return S_OK;
    170178}
    171 
    172 
    173 void HostDnsServiceLinux::stop()
    174 {
    175     send(g_DnsMonitorStop[0], "", 1, 0);
    176 }
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