Wq clean state 2

Supersedes #267, removing the wait when no tasks have returned, as per Dinesh comment.

- Do a disconnect on reset. Before, when a master disconnected from a foreman, the state of the foreman was not completely cleaned. Some tasks remained on the queue, and unprocessed messages remained on the links. This confused a new master connecting to the foreman. This pull request fixes this with a "hard reset", which asks the foreman-workers to form the hierarchy again. We may want to revisit this with a more elegant solution.