Changeset 55223 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Apr 13, 2015 6:06:30 PM (10 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostDnsService.cpp
r55200 r55223 29 29 30 30 #include <algorithm> 31 #include <set> 31 32 #include <string> 32 33 #include "HostDnsService.h" … … 39 40 40 41 41 bool HostDnsInformation::equals(const HostDnsInformation &info) const 42 { 43 return (servers == info.servers) 44 && (domain == info.domain) 45 && (searchList == info.searchList); 42 bool HostDnsInformation::equals(const HostDnsInformation &info, bool fDNSOrderIgnore) const 43 { 44 if (fDNSOrderIgnore) 45 { 46 std::set<std::string> l(servers.begin(), servers.end()); 47 std::set<std::string> r(info.servers.begin(), info.servers.end()); 48 49 return (l == r) 50 && (domain == info.domain) 51 && (searchList == info.searchList); // XXX: also ignore order? 52 } 53 else 54 { 55 return (servers == info.servers) 56 && (domain == info.domain) 57 && (searchList == info.searchList); 58 } 46 59 } 47 60 … … 57 70 struct HostDnsMonitor::Data 58 71 { 59 Data(bool aThreaded) : 72 Data(bool aThreaded) 73 : fDNSOrderIgnore(false), 60 74 fThreaded(aThreaded) 61 75 {} … … 63 77 std::vector<PCHostDnsMonitorProxy> proxies; 64 78 HostDnsInformation info; 79 bool fDNSOrderIgnore; 65 80 const bool fThreaded; 66 81 RTTHREAD hMonitoringThread; … … 108 123 } 109 124 110 const HostDnsMonitor *HostDnsMonitor::getHostDnsMonitor( )125 const HostDnsMonitor *HostDnsMonitor::getHostDnsMonitor(VirtualBox *aParent) 111 126 { 112 127 /* XXX: Moved initialization from HostImpl.cpp */ … … 128 143 g_monitor = new HostDnsService(); 129 144 # endif 130 g_monitor->init( );145 g_monitor->init(aParent); 131 146 } 132 147 … … 179 194 dumpHostDnsInformation(info); 180 195 196 bool fIgnore = m->fDNSOrderIgnore && info.equals(m->info, m->fDNSOrderIgnore); 181 197 m->info = info; 198 199 if (fIgnore) 200 { 201 LogRel(("HostDnsMonitor: order change only, not notifying\n")); 202 return; 203 } 182 204 183 205 std::vector<PCHostDnsMonitorProxy>::const_iterator it; … … 186 208 } 187 209 188 HRESULT HostDnsMonitor::init() 189 { 210 HRESULT HostDnsMonitor::init(VirtualBox *virtualbox) 211 { 212 const com::Bstr bstrHostDNSOrderIgnoreKey("VBoxInternal2/HostDNSOrderIgnore"); 213 com::Bstr bstrHostDNSOrderIgnore; 214 virtualbox->GetExtraData(bstrHostDNSOrderIgnoreKey.raw(), 215 bstrHostDNSOrderIgnore.asOutParam()); 216 217 if (bstrHostDNSOrderIgnore.isNotEmpty()) 218 { 219 LogRel(("HostDnsMonitor: %ls=%ls\n", 220 bstrHostDNSOrderIgnoreKey.raw(), 221 bstrHostDNSOrderIgnore.raw())); 222 223 if (bstrHostDNSOrderIgnore != "0") 224 m->fDNSOrderIgnore = true; 225 } 226 190 227 if (m->fThreaded) 191 228 { -
trunk/src/VBox/Main/src-server/HostDnsService.h
r55200 r55223 39 39 std::string domain; 40 40 std::vector<std::string> searchList; 41 bool equals(const HostDnsInformation & ) const;41 bool equals(const HostDnsInformation &, bool fDNSOrderIgnore = false) const; 42 42 }; 43 43 … … 49 49 { 50 50 public: 51 static const HostDnsMonitor *getHostDnsMonitor( );51 static const HostDnsMonitor *getHostDnsMonitor(VirtualBox *virtualbox); 52 52 static void shutdown(); 53 53 … … 57 57 /* @note: method will wait till client call 58 58 HostDnsService::monitorThreadInitializationDone() */ 59 virtual HRESULT init( );59 virtual HRESULT init(VirtualBox *virtualbox); 60 60 61 61 protected: … … 91 91 HostDnsMonitorProxy(); 92 92 ~HostDnsMonitorProxy(); 93 void init(const HostDnsMonitor *aMonitor, VirtualBox * aParent);93 void init(const HostDnsMonitor *aMonitor, VirtualBox *virtualbox); 94 94 void notify() const; 95 95 … … 117 117 HostDnsServiceDarwin(); 118 118 ~HostDnsServiceDarwin(); 119 HRESULT init();119 virtual HRESULT init(VirtualBox *virtualbox); 120 120 121 121 protected: … … 136 136 HostDnsServiceWin(); 137 137 ~HostDnsServiceWin(); 138 HRESULT init();138 virtual HRESULT init(VirtualBox *virtualbox); 139 139 140 140 protected: … … 156 156 explicit HostDnsServiceResolvConf(bool fThreaded = false) : HostDnsMonitor(fThreaded), m(NULL) {} 157 157 virtual ~HostDnsServiceResolvConf(); 158 virtual HRESULT init( const char *aResolvConfFileName);158 virtual HRESULT init(VirtualBox *virtualbox, const char *aResolvConfFileName); 159 159 const std::string& resolvConf() const; 160 160 … … 180 180 HostDnsServiceSolaris(){} 181 181 ~HostDnsServiceSolaris(){} 182 HRESULT init(){ return HostDnsServiceResolvConf::init("/etc/resolv.conf");} 182 virtual HRESULT init(VirtualBox *virtualbox) { 183 return HostDnsServiceResolvConf::init(virtualbox, "/etc/resolv.conf"); 184 } 183 185 }; 184 186 … … 189 191 HostDnsServiceLinux():HostDnsServiceResolvConf(true){} 190 192 virtual ~HostDnsServiceLinux(); 191 virtual HRESULT init(){ return HostDnsServiceResolvConf::init("/etc/resolv.conf");} 193 virtual HRESULT init(VirtualBox *virtualbox) { 194 return HostDnsServiceResolvConf::init(virtualbox, "/etc/resolv.conf"); 195 } 192 196 193 197 protected: … … 202 206 HostDnsServiceFreebsd(){} 203 207 ~HostDnsServiceFreebsd(){} 204 HRESULT init(){ return HostDnsServiceResolvConf::init("/etc/resolv.conf");} 208 virtual HRESULT init(VirtualBox *virtualbox) { 209 return HostDnsServiceResolvConf::init(virtualbox, "/etc/resolv.conf"); 210 } 205 211 }; 206 212 … … 212 218 ~HostDnsServiceOs2(){} 213 219 /* XXX: \\MPTN\\ETC should be taken from environment variable ETC */ 214 HRESULT init(){ return init("\\MPTN\\ETC\\RESOLV2");} 220 virtual HRESULT init(VirtualBox *virtualbox) { 221 return HostDnsServiceResolvConf::init(virtualbox, "\\MPTN\\ETC\\RESOLV2"); 222 } 215 223 }; 216 224 -
trunk/src/VBox/Main/src-server/HostDnsServiceResolvConf.cpp
r53624 r55223 67 67 } 68 68 69 HRESULT HostDnsServiceResolvConf::init( const char *aResolvConfFileName)69 HRESULT HostDnsServiceResolvConf::init(VirtualBox *virtualbox, const char *aResolvConfFileName) 70 70 { 71 71 m = new Data(aResolvConfFileName); 72 72 73 HostDnsMonitor::init( );73 HostDnsMonitor::init(virtualbox); 74 74 75 75 readResolvConf(); -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r53815 r55223 300 300 i_updateNetIfList(); 301 301 302 m->hostDnsMonitorProxy.init(HostDnsMonitor::getHostDnsMonitor( ), m->pParent);302 m->hostDnsMonitorProxy.init(HostDnsMonitor::getHostDnsMonitor(m->pParent), m->pParent); 303 303 304 304 #if defined(RT_OS_WINDOWS)
Note:
See TracChangeset
for help on using the changeset viewer.