MINOR: server: add a alt_proto field for server
Add a new field alt_proto to the server structures that specify if an alternate protocol should be used for this server. This field can be transparently passed to protocol_lookup to get an appropriate protocol structure. This change allows thus to create servers with different protocols, and not only TCP anymore.
This commit is contained in:
parent
a7b04e383a
commit
38618822e1
|
@ -381,6 +381,7 @@ struct server {
|
|||
|
||||
const struct netns_entry *netns; /* contains network namespace name or NULL. Network namespace comes from configuration */
|
||||
struct xprt_ops *xprt; /* transport-layer operations */
|
||||
int alt_proto; /* alternate protocol to use in protocol_lookup */
|
||||
unsigned int svc_port; /* the port to connect to (for relevant families) */
|
||||
unsigned down_time; /* total time the server was down */
|
||||
|
||||
|
|
|
@ -3306,6 +3306,7 @@ static int _srv_parse_init(struct server **srv, char **args, int *cur_arg,
|
|||
const char *err = NULL;
|
||||
int err_code = 0;
|
||||
char *fqdn = NULL;
|
||||
int alt_proto = 0;
|
||||
int tmpl_range_low = 0, tmpl_range_high = 0;
|
||||
char *errmsg = NULL;
|
||||
|
||||
|
@ -3396,7 +3397,7 @@ static int _srv_parse_init(struct server **srv, char **args, int *cur_arg,
|
|||
goto skip_addr;
|
||||
|
||||
sk = str2sa_range(args[*cur_arg], &port, &port1, &port2, NULL, NULL, &newsrv->addr_type,
|
||||
&errmsg, NULL, &fqdn, NULL,
|
||||
&errmsg, NULL, &fqdn, &alt_proto,
|
||||
(parse_flags & SRV_PARSE_INITIAL_RESOLVE ? PA_O_RESOLVE : 0) | PA_O_PORT_OK |
|
||||
(parse_flags & SRV_PARSE_IN_PEER_SECTION ? PA_O_PORT_MAND : PA_O_PORT_OFS) |
|
||||
PA_O_STREAM | PA_O_DGRAM | PA_O_XPRT);
|
||||
|
@ -3439,6 +3440,7 @@ static int _srv_parse_init(struct server **srv, char **args, int *cur_arg,
|
|||
|
||||
newsrv->addr = *sk;
|
||||
newsrv->svc_port = port;
|
||||
newsrv->alt_proto = alt_proto;
|
||||
/*
|
||||
* we don't need to lock the server here, because
|
||||
* we are in the process of initializing.
|
||||
|
|
Loading…
Reference in New Issue