proxy progress
This commit is contained in:
parent
d20880ac2c
commit
e5ae042694
|
@ -5,6 +5,8 @@ import com.opensr5.io.DataListener;
|
|||
import com.rusefi.binaryprotocol.IncomingDataBuffer;
|
||||
import com.rusefi.io.ByteReader;
|
||||
import com.rusefi.io.serial.AbstractIoStream;
|
||||
import com.rusefi.shared.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -21,6 +23,8 @@ public class TcpIoStream extends AbstractIoStream {
|
|||
private final OutputStream output;
|
||||
private final Logger logger;
|
||||
private final String loggingPrefix;
|
||||
@NotNull
|
||||
private final Socket socket;
|
||||
private final IncomingDataBuffer dataBuffer;
|
||||
|
||||
public TcpIoStream(Logger logger, Socket socket) throws IOException {
|
||||
|
@ -29,11 +33,12 @@ public class TcpIoStream extends AbstractIoStream {
|
|||
|
||||
public TcpIoStream(String loggingPrefix, Logger logger, Socket socket) throws IOException {
|
||||
this.loggingPrefix = loggingPrefix;
|
||||
if (socket == null)
|
||||
throw new NullPointerException("socket");
|
||||
this.socket = socket;
|
||||
InputStream input = new BufferedInputStream(socket.getInputStream());
|
||||
OutputStream output = socket.getOutputStream();
|
||||
this.logger = logger;
|
||||
if (input == null)
|
||||
throw new NullPointerException("input");
|
||||
if (output == null)
|
||||
throw new NullPointerException("output");
|
||||
this.output = output;
|
||||
|
@ -41,6 +46,12 @@ public class TcpIoStream extends AbstractIoStream {
|
|||
this.dataBuffer = IncomingDataBuffer.createDataBuffer(loggingPrefix, this, logger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
super.close();
|
||||
FileUtil.close(socket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLoggingPrefix() {
|
||||
return loggingPrefix;
|
||||
|
|
|
@ -15,6 +15,8 @@ import java.util.List;
|
|||
public class ProxyClient {
|
||||
public static final String LIST_CONTROLLERS_PATH = "/list_controllers";
|
||||
public static final String LIST_APPLICATIONS_PATH = "/list_applications";
|
||||
public static final String VERSION_PATH = "/version";
|
||||
public static final String BACKEND_VERSION = "0.0001";
|
||||
|
||||
public static List<PublicSession> getOnlineApplications(int httpPort) throws IOException {
|
||||
return getOnlineApplications(HttpUtil.RUSEFI_PROXY_JSON_API_PREFIX + ":" + httpPort + LIST_CONTROLLERS_PATH);
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.rusefi.shared;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
|
@ -54,4 +51,14 @@ public class FileUtil {
|
|||
|
||||
return destFile;
|
||||
}
|
||||
|
||||
public static void close(Closeable closeable) {
|
||||
if (closeable != null) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (IOException ignored) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue