refactor listener code
fix #547
supersede !440
I'm not sure whether that fixes #408
Refactor goals where:
- Eliminate duplicate code.
- Allow multiple listener ports of the same type (service side only, config out of scope)
- Allow listening on non-localhost addresses (service side only, config out of scope)
- Fail with an error if the port binding fails for some reason other than "we don't support that address family."
- Ease future implementation of proxy reconfiguration (changing what ports are bound, and for which services)
- Make binds happen at a well defined point so #363 can be implemented more easily.
I did not want to mix that and changes in the config side of things, so while it provide the infrastructure for new features, I left out of scope the changes required to actually make use of that.
Edited by trinity-1686a