diff --git a/src/processing/mode/p5js/p5jsEditor.java b/src/processing/mode/p5js/p5jsEditor.java index c7137a9..764680e 100644 --- a/src/processing/mode/p5js/p5jsEditor.java +++ b/src/processing/mode/p5js/p5jsEditor.java @@ -36,6 +36,7 @@ public class p5jsEditor extends Editor { HttpServer server; + boolean reusePort = true; boolean showSizeWarning = true; @@ -306,8 +307,10 @@ public void handleStop() { } catch (IOException e) { e.printStackTrace(); // TODO ignore? } - stopServer(); - statusNotice("Server stopped."); + if (!reusePort) { + stopServer(); + statusNotice("Server stopped."); + } toolbar.deactivateRun(); } diff --git a/src/processing/mode/p5js/server/HttpServer.java b/src/processing/mode/p5js/server/HttpServer.java index b1e3bc0..5954686 100644 --- a/src/processing/mode/p5js/server/HttpServer.java +++ b/src/processing/mode/p5js/server/HttpServer.java @@ -76,6 +76,7 @@ public HttpServer(p5jsEditor editor, int port) { public void start() { + if (thread == null) { thread = new Thread(new Runnable() { @Override public void run() { @@ -120,6 +121,7 @@ public void run() { running = false; } }); + } thread.start(); }