Skip to content

Commit

Permalink
OK we just turn it off.
Browse files Browse the repository at this point in the history
  • Loading branch information
kglovern committed Jul 11, 2024
1 parent 591925b commit 3aa797f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/app/widgets/NavbarConnection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import get from 'lodash/get';
import reverse from 'lodash/reverse';
import ip from 'ip';
import sortBy from 'lodash/sortBy';
import uniq from 'lodash/uniq';
import { connect } from 'react-redux';
Expand Down Expand Up @@ -238,7 +239,9 @@ class NavbarConnectionWidget extends PureComponent {
attemptAutoConnect() {
const { autoReconnect, hasReconnected, port, baudrate, controllerType } = this.state;
const { ports } = this.props;

if (ip.isV4Format(port)) {
return; // No auto reconnect on ethernet for now
}
if (autoReconnect && !hasReconnected) {
setTimeout(() => {
this.setState(state => ({
Expand Down
14 changes: 7 additions & 7 deletions src/server/lib/SerialConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ class SerialConnection extends EventEmitter {
if (err.code === 'ECONNRESET') {
console.log('reset error, attempting to destroy');
this.port.destroy();
this.port = null;
if (this.callback) {
console.log('callback');
this.callback(err);
}
}
Expand Down Expand Up @@ -178,13 +180,11 @@ class SerialConnection extends EventEmitter {

// Single telnet - don't return early, just close it and reopen it
if (this.port && (network || looksLikeIP)) {
if (this.port.writable) {
this.port.destroy();
this.port = null;
const err = new Error('Serial port connection reset');
callback(err);
return;
}
this.port.destroy();
this.port = null;
const err = new Error('Serial port connection reset');
callback(err);
return;
}


Expand Down

0 comments on commit 3aa797f

Please sign in to comment.