tcp search bugfix

when TCP device is discovered, wait to register it till socket closes. this way we don't have two sockets going at once!
This commit is contained in:
sparks-alec
2023-01-04 05:14:42 -05:00
parent 5a44a7d751
commit 77e0d59864
+9 -7
View File
@@ -121,14 +121,16 @@ function TCPtest(ipAddr, pluginType, pluginConfig) {
});
client.on('data', (data) => {
if (pluginConfig.searchOptions.validateResponse(data)) {
DEVICE.registerDevice({
type: pluginType,
defaultName: pluginConfig.defaultName,
port: pluginConfig.defaultPort,
addresses: [ipAddr],
});
client.end(
'',
DEVICE.registerDevice({
type: pluginType,
defaultName: pluginConfig.defaultName,
port: pluginConfig.defaultPort,
addresses: [ipAddr],
})
);
}
client.end();
});
client.on('error', (err) => {
// no device here