proxy progress
This commit is contained in:
parent
69e64bc6a7
commit
f7146b3899
|
@ -34,7 +34,7 @@ public class BinaryProtocolProxy {
|
|||
TcpIoStream clientStream = null;
|
||||
try {
|
||||
clientStream = new TcpIoStream("[[proxy]] ", clientSocket);
|
||||
runProxy(targetEcuSocket, clientStream, relayCommandCounter);
|
||||
runProxy(targetEcuSocket, clientStream, relayCommandCounter, USER_IO_TIMEOUT);
|
||||
} catch (IOException e) {
|
||||
log.error("BinaryProtocolProxy::run " + e);
|
||||
close(clientStream);
|
||||
|
@ -43,12 +43,12 @@ public class BinaryProtocolProxy {
|
|||
return BinaryProtocolServer.tcpServerSocket(serverProxyPort, "proxy", clientSocketRunnableFactory, Listener.empty());
|
||||
}
|
||||
|
||||
public static void runProxy(IoStream targetEcu, IoStream clientStream, AtomicInteger relayCommandCounter) throws IOException {
|
||||
public static void runProxy(IoStream targetEcu, IoStream clientStream, AtomicInteger relayCommandCounter, int timeoutMs) throws IOException {
|
||||
/*
|
||||
* Each client socket is running on it's own thread
|
||||
*/
|
||||
while (!targetEcu.isClosed()) {
|
||||
byte firstByte = clientStream.getDataBuffer().readByte(USER_IO_TIMEOUT);
|
||||
byte firstByte = clientStream.getDataBuffer().readByte(timeoutMs);
|
||||
if (firstByte == COMMAND_PROTOCOL) {
|
||||
clientStream.write(TS_PROTOCOL.getBytes());
|
||||
continue;
|
||||
|
|
|
@ -63,6 +63,7 @@ public class TcpIoStream extends AbstractIoStream {
|
|||
|
||||
@Override
|
||||
public void write(byte[] bytes) throws IOException {
|
||||
super.write(bytes);
|
||||
output.write(bytes);
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ public class Backend implements Closeable {
|
|||
applications.add(applicationConnectionState);
|
||||
}
|
||||
|
||||
BinaryProtocolProxy.runProxy(state.getStream(), applicationClientStream, new AtomicInteger());
|
||||
BinaryProtocolProxy.runProxy(state.getStream(), applicationClientStream, new AtomicInteger(), BinaryProtocolProxy.USER_IO_TIMEOUT);
|
||||
|
||||
} catch (Throwable e) {
|
||||
log.info("Application Connector: Got error " + e);
|
||||
|
|
|
@ -153,7 +153,7 @@ public class RemoteTab {
|
|||
bottomPanel.add(new JLabel(" Used by " + publicSession.getOwnerName()));
|
||||
} else {
|
||||
JButton connect = new JButton("Connect to " + publicSession.getUserDetails().getUserName());
|
||||
connect.addActionListener(event -> connecToToProxy(publicSession, controllerInfo));
|
||||
connect.addActionListener(event -> connectToProxy(publicSession, controllerInfo));
|
||||
bottomPanel.add(connect);
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class RemoteTab {
|
|||
return userPanel;
|
||||
}
|
||||
|
||||
private void connecToToProxy(PublicSession publicSession, ControllerInfo controllerInfo) {
|
||||
private void connectToProxy(PublicSession publicSession, ControllerInfo controllerInfo) {
|
||||
RemoteTabController.INSTANCE.setState(RemoteTabController.State.CONNECTING);
|
||||
setStatus("Connecting to " + publicSession.getUserDetails().getUserName());
|
||||
|
||||
|
|
Loading…
Reference in New Issue