Static initializer for backend.

This commit is contained in:
Ian Gulliver
2016-02-15 18:44:26 +00:00
parent bb1e5cf2ff
commit 7986d40569

View File

@@ -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) {