Comments (7)
Heh, good question. Not sure if it possible at all. I'll look into it.
On Dec 17, 2012, at 15:33, thunder [email protected] wrote:
Hello, how is it possible to handle a stop/start of hte mDNS daemon (avahi-daemon for me on debian).
In case of daemon stop, the client crash and need to be restarted.
Thx.
—
Reply to this email directly or view it on GitHub.
from node_mdns.
It's possible in python for example. Calibre, the e-book library management, handle such thing right. But i don't know how :)
from node_mdns.
Well, obviously it's possible. What I meant is: It might not be fixable in mdns. If that's the case I'll report it upstream to the node/libuv guys...
On Dec 17, 2012, at 17:37, thunder [email protected] wrote:
It's possible in python for example. Calibre, the e-book library management, handle such thing right. But i don't know how :)
—
Reply to this email directly or view it on GitHub.
from node_mdns.
Well, for me it doesn't crash. If the daemon is down while creating a browser I get an exception. When the daemon goes down while browsing I get an error event. Both is easy to handle:
var mdns = require('./lib/mdns');
try {
var b = mdns.createBrowser(mdns.tcp('http'));
} catch (ex) {
console.log('something bad happened. we better start over.')
}
b.on('error', function(error) {
console.log('something bad happened. we better start over.')
});
b.start();
The error is a bit vague though. But I can't change that. mdns only forwards what the underlying library reports. However, in case of an unknown error it is probably best to set up a new browser and start over anyway. The only improvement on the mdns side I can think of is to attach the actual error code to the exception/error object. The source code looks a bit like I've tried that already and it probably wasn't that simple. However, I'll give it another try (See #57)...
Tested on ubuntu 11.10, node 0.8.12, mdns 1.0.0.
from node_mdns.
Sorry you arre right : no crash (i missed to attach the 'error' handler). The solution is to restart the browser/createAdvertisement. I will try this. back soon.
Thx
from node_mdns.
below code to handle avahi errors :
function createAdvertisement() {
try {
var mdns_txt_record = {
name: domoConfig.domoConf.svcName,
port: domoConfig.domoConf.svcPort
};
var advert = mdns.createAdvertisement(mdns.tcp(domoConfig.domoConf.svcName) , domoConfig.domoConf.svcPort, {txtRecord: mdns_txt_record});
advert.on('error', function(error) {
console.log("advert ERROR ", error);
setTimeout(createAdvertisement, 30 * 1000);
});
advert.start();
} catch (ex){
console.log("advert creation ERROR ");
setTimeout(createAdvertisement, 30 * 1000);
}
}
}
Thx for your help
from node_mdns.
You're welcome.
from node_mdns.
Related Issues (20)
- install fails on void linux
- Failure on Raspberry Pi: getaddrinfo -3001 HOT 6
- Error on node-gyp HOT 2
- Issues with Airplay. HOT 1
- Module not "context aware" - cannot be used in Electron
- The specified procedure could not be found HOT 5
- Discovery crashes when running in Docker HOT 2
- Error while discovering services getaddrinfo -3008 HOT 2
- Use mdns.Browser over VPN connection HOT 3
- Favor dns_sd DNSServiceGetAddrInfo on linux as well HOT 2
- Debian 10 won't run this module HOT 4
- Install issue? HOT 5
- Unable to install on macos monterey HOT 2
- Cannot import mdns from a Worker HOT 5
- Handle getaddrinfo error gracefully HOT 5
- Broken links for documentation, donation button, more
- Cannot compile/install on Raspberry Pi OS due to missing dns_sd.h
- Arbitrary service_name length limit HOT 3
- Can't install mdns package on ubuntu 22.04 and nodejs v20.13.0 HOT 2
- Node 20.13+: Crash on getaddrinfo_0_11 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node_mdns.