| 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"; |