Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions service/src/main/java/org/red5/daemon/EngineLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,18 @@ public static void main(String[] args) {
*/
public static void windowsService(String args[]) {
String cmd = "start";
if (args.length > 0) {
if (args != null && args.length > 0) {
cmd = args[0];
}
if ("start".equals(cmd)) {
engineLauncherInstance.windowsStart();
} else {
commandLineArgs = args;
// drop the leading control arg so stop receives only port / token
if (args != null && args.length > 1) {
commandLineArgs = Arrays.copyOfRange(args, 1, args.length);
} else {
commandLineArgs = new String[0];
}
engineLauncherInstance.windowsStop();
}
}
Expand Down Expand Up @@ -157,7 +162,10 @@ private void initialize() {
public void terminate() {
if (stopped.compareAndSet(false, true)) {
System.out.printf("Stopping Red5 with args: %s%n", Arrays.toString(commandLineArgs));
if (commandLineArgs == null || commandLineArgs.length < 2) {
if (commandLineArgs == null) {
commandLineArgs = new String[0];
}
if (commandLineArgs.length < 2) {
// there should be 40+ characters worth of args (port + token)
// use the default port of 9999
String port = "9999";
Expand Down