removed superfluous return code from spec
This commit is contained in:
parent
213d48c087
commit
88e745346e
4 changed files with 7 additions and 12 deletions
|
|
@ -101,14 +101,10 @@ public class JobServClient {
|
||||||
int newProcess = this.api.sendNewJobMessage(command);
|
int newProcess = this.api.sendNewJobMessage(command);
|
||||||
switch(newProcess) {
|
switch(newProcess) {
|
||||||
case -1:
|
case -1:
|
||||||
System.out.println(this.serversideTimeoutErrorMessage);
|
System.out.println("Server failed to spawn process. Bad command.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -2:
|
case -2:
|
||||||
System.out.println("Server failed to create job, check server logs.");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case -3:
|
|
||||||
// error logged by API Connector
|
// error logged by API Connector
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,8 @@ class JobServClientAPIConnector {
|
||||||
* sendNewJobMessage()
|
* sendNewJobMessage()
|
||||||
* sends a shell command to the api server
|
* sends a shell command to the api server
|
||||||
* returns new pid of job
|
* returns new pid of job
|
||||||
* or -1 if server thread couldnt synchronize before timeout
|
* or -1 if server failed to create job
|
||||||
* or -2 if server failed to create job
|
* or -2 if client fails to connect
|
||||||
* or -3 if client fails to connect
|
|
||||||
*/
|
*/
|
||||||
public int sendNewJobMessage(String command) {
|
public int sendNewJobMessage(String command) {
|
||||||
// thought of escaping this, but the vulnerability is only client side, from client user input.
|
// thought of escaping this, but the vulnerability is only client side, from client user input.
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,13 @@ class ProcessManager {
|
||||||
/*
|
/*
|
||||||
* newProcess()
|
* newProcess()
|
||||||
* Takes a command and returns the translated pid of a new process
|
* Takes a command and returns the translated pid of a new process
|
||||||
* Returns -1 if getLock fails TODO: REMOVE
|
* Returns -1 if controller throws an IOException
|
||||||
* Returns -2 if controller throws an IOException
|
|
||||||
*/
|
*/
|
||||||
public int newProcess(String command) {
|
public int newProcess(String command) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProcessController newProc = new ProcessController(command);
|
ProcessController newProc = new ProcessController(command);
|
||||||
|
// we dont need to lock the map yet
|
||||||
this.lockMap.put(newProc.getPid(), true);
|
this.lockMap.put(newProc.getPid(), true);
|
||||||
this.processMap.put(newProc.getPid(), newProc);
|
this.processMap.put(newProc.getPid(), newProc);
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ class ProcessManager {
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Couldnt Spawn New Command: " + e.getMessage());
|
System.err.println("Couldnt Spawn New Command: " + e.getMessage());
|
||||||
return -2;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class ProcessManagerTest {
|
||||||
@Test
|
@Test
|
||||||
public void addProcessesTest() {
|
public void addProcessesTest() {
|
||||||
int pid = manager.newProcess("sleep 1");
|
int pid = manager.newProcess("sleep 1");
|
||||||
assertNotEquals(-2, pid);
|
assertNotEquals(-1, pid);
|
||||||
|
|
||||||
manager.shutdown();
|
manager.shutdown();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue