Max connections setting introduced

This was quite mandatory for us. You might merge this into your code if you wish.