mirror of https://github.com/rusefi/rusefi-1.git
This commit is contained in:
parent
3c701edaeb
commit
2a8945fb36
|
@ -5,6 +5,7 @@ import com.opensr5.Logger;
|
||||||
import com.rusefi.Listener;
|
import com.rusefi.Listener;
|
||||||
import com.rusefi.binaryprotocol.*;
|
import com.rusefi.binaryprotocol.*;
|
||||||
import com.rusefi.config.generated.Fields;
|
import com.rusefi.config.generated.Fields;
|
||||||
|
import com.rusefi.io.IoStream;
|
||||||
import com.rusefi.io.LinkManager;
|
import com.rusefi.io.LinkManager;
|
||||||
import com.rusefi.io.commands.HelloCommand;
|
import com.rusefi.io.commands.HelloCommand;
|
||||||
import com.rusefi.server.rusEFISSLContext;
|
import com.rusefi.server.rusEFISSLContext;
|
||||||
|
@ -210,11 +211,10 @@ public class BinaryProtocolServer implements BinaryProtocolCommands {
|
||||||
int crc = in.readInt();
|
int crc = in.readInt();
|
||||||
int fromPacket = IoHelper.getCrc32(packet);
|
int fromPacket = IoHelper.getCrc32(packet);
|
||||||
if (crc != fromPacket)
|
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);
|
return new Packet(packet, crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface Handler {
|
public interface Handler {
|
||||||
void handle() throws IOException;
|
void handle() throws IOException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,10 @@ public class NetworkConnector {
|
||||||
String vehicleName = Fields.VEHICLENAME.getStringValue(image);
|
String vehicleName = Fields.VEHICLENAME.getStringValue(image);
|
||||||
String engineMake = Fields.ENGINEMAKE.getStringValue(image);
|
String engineMake = Fields.ENGINEMAKE.getStringValue(image);
|
||||||
String engineCode = Fields.ENGINECODE.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());
|
SessionDetails deviceSessionDetails = new SessionDetails(ci, authToken, SessionDetails.createOneTimeCode());
|
||||||
|
|
||||||
BaseBroadcastingThread baseBroadcastingThread = new BaseBroadcastingThread(rusEFISSLContext.getSSLSocket(HttpUtil.RUSEFI_PROXY_HOSTNAME, serverPortForControllers),
|
BaseBroadcastingThread baseBroadcastingThread = new BaseBroadcastingThread(rusEFISSLContext.getSSLSocket(HttpUtil.RUSEFI_PROXY_HOSTNAME, serverPortForControllers),
|
||||||
|
|
|
@ -21,6 +21,7 @@ import javax.json.JsonArrayBuilder;
|
||||||
import javax.json.JsonObject;
|
import javax.json.JsonObject;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.BindException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
@ -56,6 +57,7 @@ public class Backend implements Closeable {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
System.out.println("Starting http backend on " + httpPort);
|
System.out.println("Starting http backend on " + httpPort);
|
||||||
|
try {
|
||||||
new FtBasic(
|
new FtBasic(
|
||||||
new TkFork(showOnlineUsers,
|
new TkFork(showOnlineUsers,
|
||||||
Monitoring.showStatistics,
|
Monitoring.showStatistics,
|
||||||
|
@ -71,6 +73,9 @@ public class Backend implements Closeable {
|
||||||
"</body></html>\n"))
|
"</body></html>\n"))
|
||||||
), httpPort
|
), httpPort
|
||||||
).start(() -> isClosed);
|
).start(() -> isClosed);
|
||||||
|
} catch (BindException e) {
|
||||||
|
throw new IllegalStateException("While binding " + httpPort, e);
|
||||||
|
}
|
||||||
logger.info("Shutting down backend on port " + httpPort);
|
logger.info("Shutting down backend on port " + httpPort);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
|
|
Loading…
Reference in New Issue