mirror of https://github.com/rusefi/rusefi-1.git
parent
6e76a9c4a9
commit
4e56edc93e
|
@ -188,7 +188,11 @@ public class LinkManager {
|
||||||
int portPart = TcpConnector.getTcpPort(port);
|
int portPart = TcpConnector.getTcpPort(port);
|
||||||
String hostname = TcpConnector.getHostname(port);
|
String hostname = TcpConnector.getHostname(port);
|
||||||
socket = new Socket(hostname, portPart);
|
socket = new Socket(hostname, portPart);
|
||||||
return new TcpIoStream(logger, socket);
|
TcpIoStream tcpIoStream = new TcpIoStream(logger, socket);
|
||||||
|
IncomingDataBuffer dataBuffer = IncomingDataBuffer.createDataBuffer(tcpIoStream, logger);
|
||||||
|
tcpIoStream.setDataBuffer(dataBuffer);
|
||||||
|
|
||||||
|
return tcpIoStream;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
stateListener.onConnectionFailed();
|
stateListener.onConnectionFailed();
|
||||||
return null;
|
return null;
|
||||||
|
@ -196,20 +200,7 @@ public class LinkManager {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Callable<IoStream> ioStreamCallable = new Callable<IoStream>() {
|
setConnector(new StreamConnector(this, port, logger, streamFactory));
|
||||||
@Override
|
|
||||||
public IoStream call() {
|
|
||||||
IoStream stream = streamFactory.call();
|
|
||||||
if (stream == null) {
|
|
||||||
// error already reported
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
IncomingDataBuffer dataBuffer = IncomingDataBuffer.createDataBuffer(stream, logger);
|
|
||||||
stream.setDataBuffer(dataBuffer);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
setConnector(new StreamConnector(this, port, logger, ioStreamCallable));
|
|
||||||
isSimulationMode = true;
|
isSimulationMode = true;
|
||||||
} else {
|
} else {
|
||||||
Callable<IoStream> ioStreamCallable = () -> SerialIoStreamJSerialComm.openPort(port, logger);
|
Callable<IoStream> ioStreamCallable = () -> SerialIoStreamJSerialComm.openPort(port, logger);
|
||||||
|
|
Loading…
Reference in New Issue