MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / update

Method update

modules/network/mdns/mdns.js:88–108  ·  view source on GitHub ↗
(service)

Source from the content-addressed store, hash-verified

86 service.timer.interval = 500;
87 }
88 update(service) {
89 const index = this.services.indexOf(service);
90 if (index < 0) throw new Error("service not found");
91
92 if (!service.updater) {
93 service.updater = Timer.set(updater => {
94 this.write(MDNS.IP, MDNS.PORT, this.reply(null, 0x04 | 0x8000, service));
95 updater.interval += 250;
96 if (updater.interval >= 1500) {
97 Timer.clear(updater);
98 delete service.updater;
99 delete service.update;
100 }
101 else
102 Timer.schedule(updater, updater.interval, 250);
103 }, 0, 250);
104 }
105 else
106 Timer.schedule(service.updater, 0, 250);
107 service.updater.interval = 0;
108 }
109 remove(service, callback) {
110 if ("string" === typeof service) {
111 service += ".local";

Callers 1

changedMethod · 0.45

Calls 5

replyMethod · 0.95
scheduleMethod · 0.80
setMethod · 0.65
writeMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected