Skip to content

Commit

Permalink
Start mdns inside of a try/catch to ensure that the app will start wi…
Browse files Browse the repository at this point in the history
…thout mdns
  • Loading branch information
prgsmall committed Apr 18, 2012
1 parent cb7de0f commit f78a4f0
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions lib/acequia.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ var INTERNAL_IP = "0.0.0.0",

var tcp_ad, osc_ad, ws_ad;

var isWindows = !!require("os").platform().match(/^win/);

// The list of clients
var clients = new ac.AcequiaClients(TIMEOUT * 1000);

Expand Down Expand Up @@ -58,13 +56,12 @@ function startServers() {
oscServer.on("listening", function () {
logger.debug("OSC Server is listening on [%s:%s]", oscServer.address().address, oscServer.address().port);

if (!isWindows) {
try {
try {
var mdns = require("mdns"),
osc_ad = mdns.createAdvertisement(mdns.udp('acequia', 'osc'), oscServer.address().port, {name: "Acequia OSC Server"});
osc_ad.start();
}catch(e){
}
} catch (e) {
logger.error("Error creating mDNS advertisement: " + e.message);
}
});

Expand Down Expand Up @@ -174,17 +171,16 @@ function startServers() {
socket.destroy();
});
});

tcpServer.on("listening", function () {
logger.debug("TCP Server is listening on [%s:%s]", tcpServer.address().address, tcpServer.address().port);

if (!isWindows) {
try {
try {
var mdns = require("mdns");
tcp_ad = mdns.createAdvertisement(mdns.tcp('acequia'), tcpServer.address().port, {name: "Acequia TCP Server"});
tcp_ad.start();
}catch(e){
}
} catch (e) {
logger.error("Error creating mDNS advertisement: " + e.message);
}
});

Expand Down

0 comments on commit f78a4f0

Please sign in to comment.