Skip to content

Commit dcef287

Browse files
committed
The remote server is disabled by default; closes #934
1 parent 08e52ca commit dcef287

6 files changed

Lines changed: 44 additions & 5 deletions

File tree

distribution/ReleaseNotes.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Release Notes
22

3+
HEAD, planned as v0.30
4+
- The remote server is now disabled by default.
5+
It must be enabled in the settings.
6+
37
v0.29, released on 11. February 2022
48
- Allows loading byte base files in big-endian format.
59
- Added some more DIL chips

src/main/java/de/neemann/digital/core/element/Keys.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,24 @@ private Keys() {
528528
* enables tunnel rename dialog
529529
*/
530530
public static final Key<Boolean> SETTINGS_SHOW_TUNNEL_RENAME_DIALOG
531-
= new Key<>("tunnelRenameDialog", true).setSecondary();
531+
= new Key<>("tunnelRenameDialog", true);
532+
533+
/**
534+
* enables remote port
535+
*/
536+
public static final Key<Boolean> SETTINGS_OPEN_REMOTE_PORT
537+
= new Key<>("openRemotePort", false).setSecondary().setRequiresRestart();
538+
/**
539+
* remote port
540+
*/
541+
public static final Key<Integer> SETTINGS_REMOTE_PORT
542+
= new Key.KeyInteger("remotePort", 41114)
543+
.setMin(0)
544+
.setMax(0xffff)
545+
.setComboBoxValues(41114)
546+
.setSecondary()
547+
.setRequiresRestart()
548+
.setDependsOn(SETTINGS_OPEN_REMOTE_PORT);
532549

533550
/**
534551
* Counter used to detect oscillations

src/main/java/de/neemann/digital/gui/Main.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,10 +2135,14 @@ else if (s.trim().length() > 0) {
21352135
}
21362136

21372137
Main main = builder.build();
2138-
try {
2139-
new RemoteSever(new DigitalHandler(main)).start(41114);
2140-
} catch (IOException e) {
2141-
SwingUtilities.invokeLater(() -> main.statusLabel.setText(Lang.get("err_portIsInUse")));
2138+
if (Settings.getInstance().get(Keys.SETTINGS_OPEN_REMOTE_PORT)) {
2139+
final int port = Settings.getInstance().get(Keys.SETTINGS_REMOTE_PORT);
2140+
LOGGER.info("open remote port " + port);
2141+
try {
2142+
new RemoteSever(new DigitalHandler(main)).start(port);
2143+
} catch (IOException e) {
2144+
SwingUtilities.invokeLater(() -> main.statusLabel.setText(Lang.get("err_portIsInUse")));
2145+
}
21422146
}
21432147
main.setVisible(true);
21442148

src/main/java/de/neemann/digital/gui/Settings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ private static List<Key> createKeyList() {
6161
intList.add(Keys.SETTINGS_MAC_MOUSE);
6262
intList.add(Keys.SETTINGS_USE_EQUALS_KEY);
6363
intList.add(Keys.SETTINGS_SHOW_TUNNEL_RENAME_DIALOG);
64+
intList.add(Keys.SETTINGS_OPEN_REMOTE_PORT);
65+
intList.add(Keys.SETTINGS_REMOTE_PORT);
6466

6567
return Collections.unmodifiableList(intList);
6668
}

src/main/resources/lang/lang_de.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,12 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
16931693
<string name="key_port">Port</string>
16941694
<string name="key_port_tt">Der vom Server zu öffnende Port.</string>
16951695

1696+
<string name="key_openRemotePort">Remote-Verbindung zulassen</string>
1697+
<string name="key_openRemotePort_tt">Wenn gesetzt, wird ein TCP/IP Port geöffnet, über welchen die Steuerung
1698+
des Simulators möglich ist.</string>
1699+
<string name="key_remotePort">Port-Nummer</string>
1700+
<string name="key_remotePort_tt">Der Port, auf welchem der Remote-Server geöffnet wird.</string>
1701+
16961702
<string name="key_skipHDL">In Verilog/VHDL-Export auslassen</string>
16971703
<string name="key_skipHDL_tt">Wenn gesetzt wird diese Schaltung bei der Generierung von
16981704
Verilog/VHDL ausgelassen. Die Verweise auf die Schaltung werden beibehalten, sodass eine eigene

src/main/resources/lang/lang_en.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,12 @@
16751675
<string name="key_port">Port</string>
16761676
<string name="key_port_tt">The port to be opened by the server.</string>
16771677

1678+
<string name="key_openRemotePort">Allow remote connection</string>
1679+
<string name="key_openRemotePort_tt">If set, a TCP/IP port is opened, through which the control of the
1680+
simulator is possible.</string>
1681+
<string name="key_remotePort">Port number</string>
1682+
<string name="key_remotePort_tt">The port on which the remote server is opened.</string>
1683+
16781684
<string name="key_skipHDL">Skip in Verilog/VHDL export</string>
16791685
<string name="key_skipHDL_tt">Skips generating the internals of the circuit in Verilog/VHDL
16801686
export. The references to the circuit are kept, making it possible to override the

0 commit comments

Comments
 (0)