Skip to content

Commit

Permalink
Make restart work without calling stop first
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Norman committed Aug 9, 2018
1 parent d04a70a commit 91403ab
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/turtle/env/model/TestNode.d
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,25 @@ import ocean.task.Task;
Restarts the fake node, reopening the listening socket on the same port
determined in the initial call to start().
Notes:
1. Restarting the node *does not* clear any data in its storage
engine. To do that, call clear().
2. You must call stop() first, before calling restart().
Note: Restarting the node *does not* clear any data in its storage
engine. To do that, call clear().
***************************************************************************/
// TODO: make this work without requiring stop first

public void restart ( )
{
verify(this.state == State.Stopped, "Node has not been stopped");
with ( State ) switch ( this.state )
{
case Stopped:
break;
case Running:
this.stop();
break;
case Init:
default:
verify(false, "Node has not been started yet");
break;
}

this.restartListeners();
this.register(theScheduler.epoll);
Expand Down

0 comments on commit 91403ab

Please sign in to comment.