mirror of https://github.com/rusefi/rusefi-1.git
proxy progress
This commit is contained in:
parent
6d25864d98
commit
b9a7efa3ac
|
@ -187,7 +187,7 @@ 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, LinkManager.this, socket);
|
return new TcpIoStream(logger, socket);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
stateListener.onConnectionFailed();
|
stateListener.onConnectionFailed();
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
|
||||||
byte command = (byte) dis.read();
|
byte command = (byte) dis.read();
|
||||||
System.out.println("Got [" + (char) command + "/" + command + "] command");
|
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) {
|
if (command == COMMAND_HELLO) {
|
||||||
stream.sendPacket((TS_OK + Fields.TS_SIGNATURE).getBytes(), logger);
|
stream.sendPacket((TS_OK + Fields.TS_SIGNATURE).getBytes(), logger);
|
||||||
} else if (command == COMMAND_PROTOCOL) {
|
} else if (command == COMMAND_PROTOCOL) {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.opensr5.Logger;
|
||||||
import com.opensr5.io.DataListener;
|
import com.opensr5.io.DataListener;
|
||||||
import com.rusefi.io.ByteReader;
|
import com.rusefi.io.ByteReader;
|
||||||
import com.rusefi.io.IoStream;
|
import com.rusefi.io.IoStream;
|
||||||
import com.rusefi.io.LinkManager;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -20,16 +19,14 @@ public class TcpIoStream implements IoStream {
|
||||||
private final InputStream input;
|
private final InputStream input;
|
||||||
private final OutputStream output;
|
private final OutputStream output;
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private final LinkManager linkManager;
|
|
||||||
private boolean isClosed;
|
private boolean isClosed;
|
||||||
|
|
||||||
public TcpIoStream(Logger logger, LinkManager linkManager, Socket socket) throws IOException {
|
public TcpIoStream(Logger logger, Socket socket) throws IOException {
|
||||||
this(logger, linkManager, new BufferedInputStream(socket.getInputStream()), socket.getOutputStream());
|
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.logger = logger;
|
||||||
this.linkManager = linkManager;
|
|
||||||
if (input == null)
|
if (input == null)
|
||||||
throw new NullPointerException("input");
|
throw new NullPointerException("input");
|
||||||
if (output == null)
|
if (output == null)
|
||||||
|
|
Loading…
Reference in New Issue