Static initializer for backend.
This commit is contained in:
25
adsbus.c
25
adsbus.c
@@ -45,6 +45,17 @@ struct peer {
|
|||||||
struct client client;
|
struct client client;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
#define PEER_BACKEND_INIT { \
|
||||||
|
.type = BACKEND, \
|
||||||
|
.backend = { \
|
||||||
|
.buf = { \
|
||||||
|
.start = 0, \
|
||||||
|
.length = 0, \
|
||||||
|
}, \
|
||||||
|
.parser_state = { 0 }, \
|
||||||
|
.parser = NULL, \
|
||||||
|
}, \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int parse_opts(int argc, char *argv[], struct opts *opts) {
|
static int parse_opts(int argc, char *argv[], struct opts *opts) {
|
||||||
@@ -115,18 +126,8 @@ static int connect_backend(struct opts *opts) {
|
|||||||
|
|
||||||
|
|
||||||
static int loop(int bfd) {
|
static int loop(int bfd) {
|
||||||
struct peer backend = {
|
struct peer backend = PEER_BACKEND_INIT;
|
||||||
.type = BACKEND,
|
backend.fd = bfd;
|
||||||
.fd = bfd,
|
|
||||||
.backend = {
|
|
||||||
.buf = {
|
|
||||||
.start = 0,
|
|
||||||
.length = 0,
|
|
||||||
},
|
|
||||||
.parser_state = { 0 },
|
|
||||||
.parser = NULL,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
int efd = epoll_create1(0);
|
int efd = epoll_create1(0);
|
||||||
if (efd == -1) {
|
if (efd == -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user