Skip to content

Commit

Permalink
fixed #170
Browse files Browse the repository at this point in the history
  • Loading branch information
windkh committed Sep 8, 2024
1 parent c2b7769 commit 63cca12
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions shelly/99-shelly.js
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ module.exports = function (RED) {
this.hostip = config.hostip;
this.server = fastify();

if (node.port > 0){
if (node.port > 0 && node.port <= 65535){
node.server.listen({port : node.port}, (err, address) => {
if (!err){
console.info("Shelly gen1 server is listening on port " + node.port);
Expand Down Expand Up @@ -1882,6 +1882,9 @@ module.exports = function (RED) {
reply.send();
});
}
else {
node.error("Shelly gen1 server failed to start: port number is not betwee 0 and 65535: " + node.port);
}

this.on('close', function (removed, done) {
node.server.close().then(() => {
Expand Down Expand Up @@ -2628,7 +2631,7 @@ module.exports = function (RED) {
this.hostip = config.hostip;
this.server = fastify();

if (node.port > 0){
if (node.port > 0 && node.port <= 65535){
node.server.listen({port : node.port}, (err, address) => {
if (!err){
console.info("Shelly gen2 server is listening on port " + node.port);
Expand Down Expand Up @@ -2659,7 +2662,10 @@ module.exports = function (RED) {
reply.send();
});
}

else {
node.error("Shelly gen1 server failed to start: port number is not betwee 0 and 65535: " + node.port);
}

this.on('close', function (removed, done) {
node.server.close().then(() => {
done();
Expand Down

0 comments on commit 63cca12

Please sign in to comment.