This commit is contained in:
parent
3c701edaeb
commit
2a8945fb36
|
@ -5,6 +5,7 @@ import com.opensr5.Logger;
|
|||
import com.rusefi.Listener;
|
||||
import com.rusefi.binaryprotocol.*;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.io.IoStream;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.io.commands.HelloCommand;
|
||||
import com.rusefi.server.rusEFISSLContext;
|
||||
|
@ -210,11 +211,10 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
|
|||
int crc = in.readInt();
|
||||
int fromPacket = IoHelper.getCrc32(packet);
|
||||
if (crc != fromPacket)
|
||||
throw new IllegalStateException("CRC mismatch " + crc + " vs " + fromPacket);
|
||||
throw new IllegalStateException("CRC mismatch " + crc + " vs " + fromPacket + " " + IoStream.printHexBinary(packet));
|
||||
return new Packet(packet, crc);
|
||||
}
|
||||
|
||||
|
||||
public interface Handler {
|
||||
void handle() throws IOException;
|
||||
}
|
||||
|
|
|
@ -61,8 +61,10 @@ public class NetworkConnector {
|
|||
String vehicleName = Fields.VEHICLENAME.getStringValue(image);
|
||||
String engineMake = Fields.ENGINEMAKE.getStringValue(image);
|
||||
String engineCode = Fields.ENGINECODE.getStringValue(image);
|
||||
ControllerInfo ci = new ControllerInfo(vehicleName, engineMake, engineCode, controllerSignature);
|
||||
//ControllerInfo ci = new ControllerInfo(vehicleName, engineMake, engineCode, controllerSignature);
|
||||
|
||||
// todo: request vehicle info from controller
|
||||
ControllerInfo ci = new ControllerInfo("vehicle", "make", "code", controllerSignature);
|
||||
SessionDetails deviceSessionDetails = new SessionDetails(ci, authToken, SessionDetails.createOneTimeCode());
|
||||
|
||||
BaseBroadcastingThread baseBroadcastingThread = new BaseBroadcastingThread(rusEFISSLContext.getSSLSocket(HttpUtil.RUSEFI_PROXY_HOSTNAME, serverPortForControllers),
|
||||
|
|
|
@ -21,6 +21,7 @@ import javax.json.JsonArrayBuilder;
|
|||
import javax.json.JsonObject;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.net.BindException;
|
||||
import java.net.Socket;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
@ -56,21 +57,25 @@ public class Backend implements Closeable {
|
|||
new Thread(() -> {
|
||||
try {
|
||||
System.out.println("Starting http backend on " + httpPort);
|
||||
new FtBasic(
|
||||
new TkFork(showOnlineUsers,
|
||||
Monitoring.showStatistics,
|
||||
new FkRegex(VERSION_PATH, BACKEND_VERSION),
|
||||
new FkRegex("/", new RsHtml("<html><body>\n" +
|
||||
"<a href='https://rusefi.com/online/'>rusEFI Online</a>\n" +
|
||||
"<br/>\n" +
|
||||
"<a href='" + Monitoring.STATUS + "'>Status</a>\n" +
|
||||
"<br/>\n" +
|
||||
"<a href='" + ProxyClient.LIST_PATH + "'>List</a>\n" +
|
||||
"<br/>\n" +
|
||||
"<br/>\n" +
|
||||
"</body></html>\n"))
|
||||
), httpPort
|
||||
).start(() -> isClosed);
|
||||
try {
|
||||
new FtBasic(
|
||||
new TkFork(showOnlineUsers,
|
||||
Monitoring.showStatistics,
|
||||
new FkRegex(VERSION_PATH, BACKEND_VERSION),
|
||||
new FkRegex("/", new RsHtml("<html><body>\n" +
|
||||
"<a href='https://rusefi.com/online/'>rusEFI Online</a>\n" +
|
||||
"<br/>\n" +
|
||||
"<a href='" + Monitoring.STATUS + "'>Status</a>\n" +
|
||||
"<br/>\n" +
|
||||
"<a href='" + ProxyClient.LIST_PATH + "'>List</a>\n" +
|
||||
"<br/>\n" +
|
||||
"<br/>\n" +
|
||||
"</body></html>\n"))
|
||||
), httpPort
|
||||
).start(() -> isClosed);
|
||||
} catch (BindException e) {
|
||||
throw new IllegalStateException("While binding " + httpPort, e);
|
||||
}
|
||||
logger.info("Shutting down backend on port " + httpPort);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
|
|
Loading…
Reference in New Issue