Skip to content

Commit b572b5e

Browse files
committed
fix: missing allowed_uuids or <server>.<state> section threw an error. add loggers on proxy connection events for better debuggability
1 parent 45ef8aa commit b572b5e

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/VaneProxyPlugin.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ public ProxyServer get_proxy() {
103103
}
104104

105105
public void try_start_server(ManagedServer server) {
106+
// FIXME: this is not async-safe and there might be conditions where two start commands can be executed
107+
// simultaneously. Don't rely on this as a user - instead use a start command that is atomic.
106108
if (server_starting) return;
107109

108110
this.server.get_scheduler()
@@ -111,6 +113,8 @@ public void try_start_server(ManagedServer server) {
111113
() -> {
112114
try {
113115
server_starting = true;
116+
get_logger().log(Level.INFO, "Running start command for server " + server.id());
117+
System.out.println("run start cmd for " + server.id() + ": " + server.start_cmd());
114118
final var timeout = server.command_timeout();
115119
final var process = Runtime.getRuntime().exec(server.start_cmd());
116120

vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/config/AuthMultiplex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class AuthMultiplex {
1111
public AuthMultiplex(Integer port, List<String> allowed_uuids) {
1212
this.port = port;
1313

14-
if (allowed_uuids.isEmpty()) {
14+
if (allowed_uuids == null || allowed_uuids.isEmpty()) {
1515
this.allowed_uuids = List.of();
1616
} else {
1717
this.allowed_uuids = allowed_uuids.stream().filter(s -> !s.isEmpty()).map(UUID::fromString).collect(Collectors.toList());

vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/config/ManagedServer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ private static class StatefulConfiguration {
117117

118118
public StatefulConfiguration(String id, String display_name, CommentedConfig config) throws IOException {
119119
// [managed_servers.my_server.state]
120+
if (config == null) {
121+
// The whole section is missing
122+
return;
123+
}
120124

121125
// quotes = ["", ...]
122126
List<String> quotes = config.get("quotes");

vane-proxy-core/src/main/java/org/oddlama/vane/proxycore/listeners/LoginEvent.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ public final void fire() {
3232
return;
3333
}
3434

35+
plugin.get_logger().log(Level.INFO, "Connection '" + connection.get_name() + "' is connecting to '" + server_info.getName() + "'");
36+
3537
// Start server if necessary
3638
if (!plugin.is_online(server_info)) {
3739
// For use inside callback
3840
final var cms = plugin.get_config().managed_servers.get(server_info.getName());
3941

4042
if (!connection.can_start_server(plugin.get_proxy(), server_info.getName())) {
43+
plugin.get_logger().log(Level.INFO, "Disconnecting '" + connection.get_name() + "' because they don't have the permission to start server '" + server_info.getName() + "'");
4144
// TODO: This could probably use a configurable message?
4245
this.cancel("Server is offline");
4346
return;

0 commit comments

Comments
 (0)