mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
MINOR: protocol: do not call proto->bind_all() anymore
All protocols only iterate over their own listeners list and start the listeners using a direct call to their ->bind() function. This code duplication doesn't make sense and prevents us from centralizing the startup error handling. Worse, it's not even symmetric because there's an unbind_all_listeners() function common to all protocols without any equivalent for binding. Let's start by directly calling each protocol's bind() function from protocol_bind_all().
This commit is contained in:
parent
06a1806083
commit
94320859f9
@ -16,6 +16,7 @@
|
|||||||
#include <haproxy/api.h>
|
#include <haproxy/api.h>
|
||||||
#include <haproxy/errors.h>
|
#include <haproxy/errors.h>
|
||||||
#include <haproxy/list.h>
|
#include <haproxy/list.h>
|
||||||
|
#include <haproxy/listener.h>
|
||||||
#include <haproxy/protocol.h>
|
#include <haproxy/protocol.h>
|
||||||
#include <haproxy/tools.h>
|
#include <haproxy/tools.h>
|
||||||
|
|
||||||
@ -57,14 +58,15 @@ void protocol_unregister(struct protocol *proto)
|
|||||||
int protocol_bind_all(char *errmsg, int errlen)
|
int protocol_bind_all(char *errmsg, int errlen)
|
||||||
{
|
{
|
||||||
struct protocol *proto;
|
struct protocol *proto;
|
||||||
|
struct listener *listener;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = 0;
|
err = 0;
|
||||||
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
||||||
list_for_each_entry(proto, &protocols, list) {
|
list_for_each_entry(proto, &protocols, list) {
|
||||||
if (proto->bind_all) {
|
list_for_each_entry(listener, &proto->listeners, proto_list) {
|
||||||
err |= proto->bind_all(proto, errmsg, errlen);
|
err |= proto->bind(listener, errmsg, errlen);
|
||||||
if ( err & ERR_ABORT )
|
if (err & ERR_ABORT)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user