CLEANUP: protocol: remove the now unused <handler> field of proto_fam->bind()

We don't need to specify the handler anymore since it's set in the
receiver. Let's remove this argument from the function and clean up
the remains of code that were still setting it.
diff --git a/include/haproxy/proto_sockpair.h b/include/haproxy/proto_sockpair.h
index 6807169..e012407 100644
--- a/include/haproxy/proto_sockpair.h
+++ b/include/haproxy/proto_sockpair.h
@@ -25,7 +25,7 @@
 
 int recv_fd_uxst(int sock);
 int send_fd_uxst(int fd, int send_fd);
-int sockpair_bind_receiver(struct receiver *rx, void (*handler)(int fd), char **errmsg);
+int sockpair_bind_receiver(struct receiver *rx, char **errmsg);
 
 #endif /* _HAPROXY_PROTO_SOCKPAIR_H  */
 
diff --git a/include/haproxy/protocol-t.h b/include/haproxy/protocol-t.h
index d50c838..1306a32 100644
--- a/include/haproxy/protocol-t.h
+++ b/include/haproxy/protocol-t.h
@@ -67,7 +67,7 @@
 	socklen_t sock_addrlen;				/* socket address length, used by bind() */
 	int l3_addrlen;					/* layer3 address length, used by hashes */
 	int (*addrcmp)(const struct sockaddr_storage *, const struct sockaddr_storage *); /* compare addresses (like memcmp) */
-	int (*bind)(struct receiver *rx, void (*handler)(int fd), char **errmsg); /* bind a receiver */
+	int (*bind)(struct receiver *rx, char **errmsg); /* bind a receiver */
 	int (*get_src)(int fd, struct sockaddr *, socklen_t, int dir); /* syscall used to retrieve src addr */
 	int (*get_dst)(int fd, struct sockaddr *, socklen_t, int dir); /* syscall used to retrieve dst addr */
 };
diff --git a/include/haproxy/sock_inet.h b/include/haproxy/sock_inet.h
index 7ecdc7b..5829fcf 100644
--- a/include/haproxy/sock_inet.h
+++ b/include/haproxy/sock_inet.h
@@ -40,6 +40,6 @@
 int sock_inet_is_foreign(int fd, sa_family_t family);
 int sock_inet4_make_foreign(int fd);
 int sock_inet6_make_foreign(int fd);
-int sock_inet_bind_receiver(struct receiver *rx, void (*handler)(int fd), char **errmsg);
+int sock_inet_bind_receiver(struct receiver *rx, char **errmsg);
 
 #endif /* _HAPROXY_SOCK_INET_H */
diff --git a/include/haproxy/sock_unix.h b/include/haproxy/sock_unix.h
index 3b46b48..9934341 100644
--- a/include/haproxy/sock_unix.h
+++ b/include/haproxy/sock_unix.h
@@ -31,6 +31,6 @@
 extern struct proto_fam proto_fam_unix;
 
 int sock_unix_addrcmp(const struct sockaddr_storage *a, const struct sockaddr_storage *b);
-int sock_unix_bind_receiver(struct receiver *rx, void (*handler)(int fd), char **errmsg);
+int sock_unix_bind_receiver(struct receiver *rx, char **errmsg);
 
 #endif /* _HAPROXY_SOCK_UNIX_H */
diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c
index 8e17460..f8e673d 100644
--- a/src/proto_sockpair.c
+++ b/src/proto_sockpair.c
@@ -124,15 +124,15 @@
 		fd_stop_recv(l->rx.fd);
 }
 
-/* Binds receiver <rx>, and assigns <handler> and rx->owner as the callback and
- * context, respectively, with <tm> as the thread mask. Returns and error code
- * made of ERR_* bits on failure or ERR_NONE on success. On failure, an error
- * message may be passed into <errmsg>. Note that the binding address is only
- * an FD to receive the incoming FDs on. Thus by definition there is no real
- * "bind" operation, this only completes the receiver. Such FDs are not
+/* Binds receiver <rx>, and assigns rx->iocb and rx->owner as the callback
+ * and context, respectively, with ->bind_thread as the thread mask. Returns an
+ * error code made of ERR_* bits on failure or ERR_NONE on success. On failure,
+ * an error message may be passed into <errmsg>. Note that the binding address
+ * is only an FD to receive the incoming FDs on. Thus by definition there is no
+ * real "bind" operation, this only completes the receiver. Such FDs are not
  * inherited upon reload.
  */
-int sockpair_bind_receiver(struct receiver *rx, void (*handler)(int fd), char **errmsg)
+int sockpair_bind_receiver(struct receiver *rx, char **errmsg)
 {
 	int err;
 
@@ -165,7 +165,7 @@
 
 	rx->flags |= RX_F_BOUND;
 
-	fd_insert(rx->fd, rx->owner, handler, thread_mask(rx->settings->bind_thread) & all_threads_mask);
+	fd_insert(rx->fd, rx->owner, rx->iocb, thread_mask(rx->settings->bind_thread) & all_threads_mask);
 	return err;
 
  bind_return:
diff --git a/src/protocol.c b/src/protocol.c
index 18ca40a..8ea36cb 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -65,7 +65,6 @@
 	struct receiver *receiver;
 	char msg[100];
 	char *errmsg;
-	void *handler;
 	int err, lerr;
 
 	err = 0;
@@ -74,12 +73,7 @@
 		list_for_each_entry(receiver, &proto->receivers, proto_list) {
 			listener = LIST_ELEM(receiver, struct listener *, rx);
 
-			/* FIXME: horrible hack, we don't have a way to register
-			 * a handler when creating the receiver yet, so we still
-			 * have to take care of special cases here.
-			 */
-			handler = listener->rx.iocb;
-			lerr = proto->fam->bind(receiver, handler, &errmsg);
+			lerr = proto->fam->bind(receiver, &errmsg);
 			err |= lerr;
 
 			/* errors are reported if <verbose> is set or if they are fatal */
diff --git a/src/sock_inet.c b/src/sock_inet.c
index 7a87fbe..6675be5 100644
--- a/src/sock_inet.c
+++ b/src/sock_inet.c
@@ -252,12 +252,12 @@
 		0;
 }
 
-/* Binds receiver <rx>, and assigns <handler> and rx->owner as the callback and
+/* Binds receiver <rx>, and assigns rx->iocb and rx->owner as the callback and
  * context, respectively. Returns and error code made of ERR_* bits on failure
  * or ERR_NONE on success. On failure, an error message may be passed into
  * <errmsg>.
  */
-int sock_inet_bind_receiver(struct receiver *rx, void (*handler)(int fd), char **errmsg)
+int sock_inet_bind_receiver(struct receiver *rx, char **errmsg)
 {
 	int fd, err, ext;
 	/* copy listener addr because sometimes we need to switch family */
@@ -377,7 +377,7 @@
 	rx->fd = fd;
 	rx->flags |= RX_F_BOUND;
 
-	fd_insert(fd, rx->owner, handler, thread_mask(rx->settings->bind_thread) & all_threads_mask);
+	fd_insert(fd, rx->owner, rx->iocb, thread_mask(rx->settings->bind_thread) & all_threads_mask);
 
 	/* for now, all regularly bound TCP listeners are exportable */
 	if (!(rx->flags & RX_F_INHERITED))
diff --git a/src/sock_unix.c b/src/sock_unix.c
index 2be8d6b..45631ac 100644
--- a/src/sock_unix.c
+++ b/src/sock_unix.c
@@ -118,12 +118,12 @@
 	return 0;
 }
 
-/* Binds receiver <rx>, and assigns <handler> and rx-> as the callback and
- * context, respectively, with <tm> as the thread mask. Returns and error code
- * made of ERR_* bits on failure or ERR_NONE on success. On failure, an error
- * message may be passed into <errmsg>.
+/* Binds receiver <rx>, and assigns rx->iocb and rx->owner as the callback and
+ * context, respectively, with ->bind_thread as the thread mask. Returns an
+ * error code made of ERR_* bits on failure or ERR_NONE on success. On failure,
+ * an error message may be passed into <errmsg>.
  */
-int sock_unix_bind_receiver(struct receiver *rx, void (*handler)(int fd), char **errmsg)
+int sock_unix_bind_receiver(struct receiver *rx, char **errmsg)
 {
 	char tempname[MAXPATHLEN];
 	char backname[MAXPATHLEN];
@@ -285,7 +285,7 @@
 	rx->fd = fd;
 	rx->flags |= RX_F_BOUND;
 
-	fd_insert(fd, rx->owner, handler, thread_mask(rx->settings->bind_thread) & all_threads_mask);
+	fd_insert(fd, rx->owner, rx->iocb, thread_mask(rx->settings->bind_thread) & all_threads_mask);
 
 	/* for now, all regularly bound TCP listeners are exportable */
 	if (!(rx->flags & RX_F_INHERITED))