Skip to content

Commit

Permalink
add a preference to not listen anymore the console in GAMAserverGUI
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaillandier committed Apr 3, 2024
1 parent 8b944a5 commit 20188aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ public static class Runtime {
/** The Constant CORE_SERVER_MODE. */
public static final Pref<Boolean> CORE_SERVER_MODE =
create("pref_enable_server", "Enables GAMA Server mode", true, IType.BOOL, true).in(NAME, SERVER)
.activates("pref_server_port", "pref_server_ping");
.activates("pref_server_port", "pref_server_ping", "pref_server_gui_console_listener");

/** The Constant CORE_SERVER_PORT. */
public static final Pref<Integer> CORE_SERVER_PORT =
Expand All @@ -570,6 +570,11 @@ public static class Runtime {
public static final Pref<Integer> CORE_SERVER_PING =
create("pref_server_ping", "Interval between two pings (-1 to disable)", 10000, IType.INT, true)
.in(NAME, SERVER);

public static final Pref<Boolean> CORE_SERVER_GUI_CONSOLE_LISTENER =
create("pref_server_gui_console_listener", "Enables GAMA GUI server mode to send the console output to the client", true, IType.BOOL, true)
.in(NAME, SERVER);

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.java_websocket.WebSocket;
import org.java_websocket.handshake.ClientHandshake;

import gama.core.common.preferences.GamaPreferences;
import gama.core.kernel.experiment.IExperimentPlan;
import gama.core.runtime.GAMA;
import gama.core.runtime.IExperimentStateListener;
Expand Down Expand Up @@ -98,7 +99,8 @@ private GamaGuiWebSocketServer(final int port, final int interval) {
@Override
public void onOpen(final WebSocket socket, final ClientHandshake handshake) {
currentServerConfig = currentServerConfig.withSocket(socket);
GAMA.getGui().getConsole().addConsoleListener(console);
if (GamaPreferences.Runtime.CORE_SERVER_GUI_CONSOLE_LISTENER.getValue())
GAMA.getGui().getConsole().addConsoleListener(console);
super.onOpen(socket, handshake);
}

Expand Down
2 changes: 1 addition & 1 deletion gama.core/src/gama/core/util/path/GamaSpatialPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ private double getDistanceComplex(final IScope scope, final boolean keepSource,
double distance = 0;
int index = 0;
int indexSegment = 0;
GamaPoint currentLocation = null;// source.getLocation().copy(scope);
GamaPoint currentLocation = null;
final int nb = segments.size();
if (!keepSource) {
double distanceS = Double.MAX_VALUE;
Expand Down

0 comments on commit 20188aa

Please sign in to comment.