proxy progress - getting REALLY close?!
This commit is contained in:
parent
31363ccb77
commit
4d5cbb2534
|
@ -2,6 +2,7 @@ package com.rusefi.io;
|
||||||
|
|
||||||
import com.opensr5.Logger;
|
import com.opensr5.Logger;
|
||||||
import com.opensr5.io.DataListener;
|
import com.opensr5.io.DataListener;
|
||||||
|
import com.rusefi.config.generated.Fields;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -25,7 +26,7 @@ public interface ByteReader {
|
||||||
Thread.currentThread().setName("TCP connector loop");
|
Thread.currentThread().setName("TCP connector loop");
|
||||||
logger.info(loggingPrefix + "Running TCP connection loop");
|
logger.info(loggingPrefix + "Running TCP connection loop");
|
||||||
|
|
||||||
byte inputBuffer[] = new byte[256];
|
byte inputBuffer[] = new byte[Fields.BLOCKING_FACTOR * 2];
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
int result = reader.read(inputBuffer);
|
int result = reader.read(inputBuffer);
|
||||||
|
|
|
@ -6,6 +6,8 @@ import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.params.HttpConnectionParams;
|
||||||
|
import org.apache.http.params.HttpParams;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
|
@ -40,6 +42,11 @@ public class HttpUtil {
|
||||||
|
|
||||||
public static HttpResponse executeGet(Logger logger, String url) throws IOException {
|
public static HttpResponse executeGet(Logger logger, String url) throws IOException {
|
||||||
HttpClient httpclient = new DefaultHttpClient();
|
HttpClient httpclient = new DefaultHttpClient();
|
||||||
|
HttpParams httpParameters = httpclient.getParams();
|
||||||
|
// HttpConnectionParams.setConnectionTimeout(httpParameters, CONNECTION_TIMEOUT);
|
||||||
|
// HttpConnectionParams.setSoTimeout(httpParameters, WAIT_RESPONSE_TIMEOUT);
|
||||||
|
// without this magic http response is pretty slow
|
||||||
|
HttpConnectionParams.setTcpNoDelay(httpParameters, true);
|
||||||
logger.info("GET " + url);
|
logger.info("GET " + url);
|
||||||
HttpGet httpget = new HttpGet(url);
|
HttpGet httpget = new HttpGet(url);
|
||||||
return httpclient.execute(httpget);
|
return httpclient.execute(httpget);
|
||||||
|
|
|
@ -112,6 +112,26 @@ public class RemoteTab {
|
||||||
JButton connect = new JButton("Connect");
|
JButton connect = new JButton("Connect");
|
||||||
connect.addActionListener(event -> {
|
connect.addActionListener(event -> {
|
||||||
|
|
||||||
|
list.removeAll();
|
||||||
|
list.add(new JLabel("Connecting to " + publicSession.getUserDetails().getUserName()));
|
||||||
|
AutoupdateUtil.trueLayout(list);
|
||||||
|
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
runAuthenticator(publicSession, controllerInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
}, "Authenticator").start();
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
userPanel.add(connect);
|
||||||
|
|
||||||
|
return userPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runAuthenticator(PublicSession publicSession, ControllerInfo controllerInfo) {
|
||||||
SessionDetails sessionDetails = new SessionDetails(controllerInfo, AuthTokenPanel.getAuthToken(),
|
SessionDetails sessionDetails = new SessionDetails(controllerInfo, AuthTokenPanel.getAuthToken(),
|
||||||
Integer.parseInt(oneTimePasswordControl.getText()));
|
Integer.parseInt(oneTimePasswordControl.getText()));
|
||||||
|
|
||||||
|
@ -127,11 +147,6 @@ public class RemoteTab {
|
||||||
// todo: proper handling
|
// todo: proper handling
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
userPanel.add(connect);
|
|
||||||
|
|
||||||
return userPanel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JComponent getContent() {
|
public JComponent getContent() {
|
||||||
|
|
Loading…
Reference in New Issue