mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
TCP Node port in use not caught properly
This commit is contained in:
parent
015adb3dfd
commit
f666b0e6f9
@ -154,15 +154,25 @@ function TcpIn(n) {
|
||||
node.log(err);
|
||||
});
|
||||
});
|
||||
server.listen(node.port);
|
||||
server.on('error', function(err) {
|
||||
if (err) {
|
||||
node.error('unable to listen on port '+node.port+' : '+err);
|
||||
}
|
||||
});
|
||||
server.listen(node.port, function(err) {
|
||||
if (err) {
|
||||
node.error('unable to listen on port '+node.port+' : '+err);
|
||||
} else {
|
||||
node.log('listening on port '+node.port);
|
||||
|
||||
this.on('close', function() {
|
||||
this.closing = true;
|
||||
node.on('close', function() {
|
||||
node.closing = true;
|
||||
server.close();
|
||||
node.log('stopped listening on port '+node.port);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
RED.nodes.registerType("tcp in",TcpIn);
|
||||
@ -273,14 +283,24 @@ function TcpOut(n) {
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(node.port);
|
||||
node.log('listening on port '+node.port);
|
||||
server.on('error', function(err) {
|
||||
if (err) {
|
||||
node.error('unable to listen on port '+node.port+' : '+err);
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(node.port, function(err) {
|
||||
if (err) {
|
||||
node.error('unable to listen on port '+node.port+' : '+err);
|
||||
} else {
|
||||
node.log('listening on port '+node.port);
|
||||
node.on('close', function() {
|
||||
server.close();
|
||||
node.log('stopped listening on port '+node.port);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
RED.nodes.registerType("tcp out",TcpOut);
|
||||
|
Loading…
Reference in New Issue
Block a user