Reset restarts before we go round again, otherwise if MaxT is large we will keep looping until it clears.
It's probably a good idea to reset "restarts" after we get the message, not when we send it; we don't want to jump back into restarting things as normal just because we have scheduled a restart.
Further documentation of this approach.
Merge bug26292