Stem leak when master deals with discarded messages
Optimisation for handling discarded deliveries
Correction and contraction
Refactor
Further refactoring
Merge bug25625
stable to default