proxy progress

This commit is contained in:
rusefi 2020-07-08 16:43:46 -04:00
parent 6d25864d98
commit b9a7efa3ac
3 changed files with 5 additions and 8 deletions

View File

@ -187,7 +187,7 @@ public class LinkManager {
int portPart = TcpConnector.getTcpPort(port);
String hostname = TcpConnector.getHostname(port);
socket = new Socket(hostname, portPart);
return new TcpIoStream(logger, LinkManager.this, socket);
return new TcpIoStream(logger, socket);
} catch (Throwable e) {
stateListener.onConnectionFailed();
return null;

View File

@ -109,7 +109,7 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
byte command = (byte) dis.read();
System.out.println("Got [" + (char) command + "/" + command + "] command");
TcpIoStream stream = new TcpIoStream(logger, linkManager, clientSocket);
TcpIoStream stream = new TcpIoStream(logger, clientSocket);
if (command == COMMAND_HELLO) {
stream.sendPacket((TS_OK + Fields.TS_SIGNATURE).getBytes(), logger);
} else if (command == COMMAND_PROTOCOL) {

View File

@ -4,7 +4,6 @@ import com.opensr5.Logger;
import com.opensr5.io.DataListener;
import com.rusefi.io.ByteReader;
import com.rusefi.io.IoStream;
import com.rusefi.io.LinkManager;
import java.io.BufferedInputStream;
import java.io.IOException;
@ -20,16 +19,14 @@ public class TcpIoStream implements IoStream {
private final InputStream input;
private final OutputStream output;
private final Logger logger;
private final LinkManager linkManager;
private boolean isClosed;
public TcpIoStream(Logger logger, LinkManager linkManager, Socket socket) throws IOException {
this(logger, linkManager, new BufferedInputStream(socket.getInputStream()), socket.getOutputStream());
public TcpIoStream(Logger logger, Socket socket) throws IOException {
this(logger, new BufferedInputStream(socket.getInputStream()), socket.getOutputStream());
}
private TcpIoStream(Logger logger, LinkManager linkManager, InputStream input, OutputStream output) {
private TcpIoStream(Logger logger, InputStream input, OutputStream output) {
this.logger = logger;
this.linkManager = linkManager;
if (input == null)
throw new NullPointerException("input");
if (output == null)