mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-28 08:30:46 +00:00
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.
This commit is contained in:
parent
a74cb38e7c
commit
233ad288cd
@ -25,7 +25,7 @@ extern struct proto_fam proto_fam_sockpair;
|
||||
|
||||
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 */
|
||||
|
||||
|
@ -67,7 +67,7 @@ struct proto_fam {
|
||||
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 */
|
||||
};
|
||||
|
@ -40,6 +40,6 @@ int sock_inet_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir);
|
||||
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 */
|
||||
|
@ -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 */
|
||||
|
@ -124,15 +124,15 @@ static void sockpair_disable_listener(struct listener *l)
|
||||
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 @@ int sockpair_bind_receiver(struct receiver *rx, void (*handler)(int fd), char **
|
||||
|
||||
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:
|
||||
|
@ -65,7 +65,6 @@ int protocol_bind_all(int verbose)
|
||||
struct receiver *receiver;
|
||||
char msg[100];
|
||||
char *errmsg;
|
||||
void *handler;
|
||||
int err, lerr;
|
||||
|
||||
err = 0;
|
||||
@ -74,12 +73,7 @@ int protocol_bind_all(int verbose)
|
||||
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 */
|
||||
|
@ -252,12 +252,12 @@ int sock_inet6_make_foreign(int fd)
|
||||
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 @@ int sock_inet_bind_receiver(struct receiver *rx, void (*handler)(int fd), char *
|
||||
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))
|
||||
|
@ -118,12 +118,12 @@ int sock_unix_addrcmp(const struct sockaddr_storage *a, const struct sockaddr_st
|
||||
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 @@ int sock_unix_bind_receiver(struct receiver *rx, void (*handler)(int fd), char *
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user