MINOR: listener: pass the chosen protocol to create_listeners()
The function will need to use more than just a family, let's pass it
the selected protocol. The caller will then be able to do all the fancy
stuff required to pick the best protocol.
diff --git a/src/listener.c b/src/listener.c
index 263508b..59aedb2 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -535,23 +535,17 @@
/* creates one or multiple listeners for bind_conf <bc> on sockaddr <ss> on port
* range <portl> to <porth>, and possibly attached to fd <fd> (or -1 for auto
- * allocation). The address family is taken from ss->ss_family. The number of
- * jobs and listeners is automatically increased by the number of listeners
- * created. It returns non-zero on success, zero on error with the error message
- * set in <err>.
+ * allocation). The address family is taken from ss->ss_family, and the protocol
+ * passed in <proto> must be usable on this family. The number of jobs and
+ * listeners is automatically increased by the number of listeners created. It
+ * returns non-zero on success, zero on error with the error message set in <err>.
*/
int create_listeners(struct bind_conf *bc, const struct sockaddr_storage *ss,
- int portl, int porth, int fd, char **err)
+ int portl, int porth, int fd, struct protocol *proto, char **err)
{
- struct protocol *proto = protocol_by_family(ss->ss_family);
struct listener *l;
int port;
- if (!proto) {
- memprintf(err, "unsupported protocol family %d", ss->ss_family);
- return 0;
- }
-
for (port = portl; port <= porth; port++) {
l = calloc(1, sizeof(*l));
if (!l) {