Move mDNS initialization (#3412)
parent
5344781de2
commit
ef40e88e21
|
@ -35,8 +35,7 @@ MdnsDiscovery.initialize = function() {
|
|||
fqdn: `${service.name}._http._tcp.local.`,
|
||||
ready: true,
|
||||
});
|
||||
}
|
||||
else if (action === 'added' && service.name.includes("elrs_rx")) {
|
||||
} else if (action === 'added' && service.name.includes("elrs_rx")) {
|
||||
//restart zeroconf if service ip doesn't arrive in 1000ms
|
||||
setTimeout(() => {
|
||||
if (self.mdnsBrowser.services.length === 0 || self.mdnsBrowser.services.filter(s => s.fqdn === `${service.name}._http._tcp.local.`)[0].ready === false) {
|
||||
|
@ -47,7 +46,8 @@ MdnsDiscovery.initialize = function() {
|
|||
}
|
||||
});
|
||||
}
|
||||
reinit();
|
||||
|
||||
reinit();
|
||||
} else {
|
||||
const bonjour = require('bonjour')();
|
||||
|
||||
|
|
|
@ -50,6 +50,10 @@ PortHandler.reinitialize = function () {
|
|||
this.showAllSerialDevices = getConfig('showAllSerialDevices').showAllSerialDevices;
|
||||
this.useMdnsBrowser = getConfig('useMdnsBrowser').useMdnsBrowser;
|
||||
|
||||
if (this.useMdnsBrowser) {
|
||||
MdnsDiscovery.initialize();
|
||||
}
|
||||
|
||||
this.check(); // start listening, check after TIMEOUT_CHECK ms
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import PortUsage from "./port_usage";
|
|||
import PortHandler from "./port_handler";
|
||||
import CONFIGURATOR, { API_VERSION_1_45, API_VERSION_1_46 } from "./data_storage";
|
||||
import serial from "./serial";
|
||||
import MdnsDiscovery from "./mdns_discovery";
|
||||
import UI_PHONES from "./phones_ui";
|
||||
import { bit_check } from './bit.js';
|
||||
import { sensor_status, have_sensor } from "./sensor_helpers";
|
||||
|
@ -171,7 +170,6 @@ export function initializeSerialBackend() {
|
|||
setConfig({'auto_connect': GUI.auto_connect});
|
||||
});
|
||||
|
||||
MdnsDiscovery.initialize();
|
||||
PortHandler.initialize();
|
||||
PortUsage.initialize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue