Auto discovery#154
Conversation
eliminates error if the user clicks "Reconnect All" button too fast
Saved settings, fixed logger outputs
| Logger.data(JSON.stringify(TelemetryData.getHeaders()), 'DATA_RELAY_HEADERS'); | ||
| StatusManager.addStatus('Received headers from data_relay', 3, 3000); | ||
|
|
||
|
|
| TelemetryData.setCurrentStateFromString(data); | ||
| TelemetryData.emitPackets(); | ||
| Logger.data(JSON.stringify(TelemetryData.getCurrentState()), 'DATA_RELAY_DATA'); | ||
| StatusManager.setStatusCode('TIMEOUT_DATA_RELAY', false); |
There was a problem hiding this comment.
dont add tabs. Set your editor to use 2 spaces
There was a problem hiding this comment.
These are spaces...
There was a problem hiding this comment.
Though I see what you mean, I will remove the 2 extra spaces
| StatusManager.setStatusCode('CONNECTED_DATA_RELAY', true); | ||
| }); | ||
| //run ipconfig command | ||
| var exec = require("child_process").exec; |
There was a problem hiding this comment.
Place your require calls at the begining of the file. Remember to document all the require calls in the file header as well
| //run and parse ipconfig | ||
| exec("ipconfig", function(err, stdout, stderr) { | ||
| if (err) { | ||
| callback(err, stderr); |
| parseHeaders(data); | ||
| do { | ||
| //search for any term in the form Bcast:#.#.#.# or broadcast:#.#.#.# | ||
| match = parsingStr.toString().match(/(?:Bcast|broadcast):([\d.]*)/); |
There was a problem hiding this comment.
I dont like having parsing logic in this file. I think you should make some kind of utility function in another module for parsing ifconfig and ipconfig outputs (if theres no module to do that). It'll also make this easier to unit test
|
|
||
| var udp_open = false; | ||
|
|
||
| server.on('error', (err) => { |
There was a problem hiding this comment.
I'd like to keep the codebase ES5 consistent, so dont use arrow functions (I do use the ${variable} in my console logs however, since its an amazing feature)
| //the message should include the port number | ||
| Logger.info('Data-relay at ' + rinfo.address.toString() + ':' + msg.toString()); | ||
| connectTCP(rinfo.address.toString(), msg.toString()); | ||
|
|
| StatusManager.setStatusCode('TIMEOUT_UDP',true); | ||
| server.close(); | ||
| } | ||
| }, 1000); |
| multiecho_timeout:5000, //in milliseconds, the amount of time a socket will wait idle before declaring itself as timed out and closing the connection | ||
| //legacy data relay | ||
| datarelay_legacy_host:'127.0.0.1', | ||
| datarelay_legacy_port:'1234' |
| var input = $('<input type="text">'); | ||
|
|
||
| var setting_type = typeof(settings.default_settings[key]) //check input type | ||
| if( setting_type === "boolean"){ |
There was a problem hiding this comment.
what do you mean? I added a line break in 56 for better readability
Found an easier way to get the netmask
|
@sergei1152 can you take a look at this again? I redid some of the parsing stuff. |
No description provided.