Non-blocking connection support.
This commit is contained in:
13
backend.h
13
backend.h
@@ -7,17 +7,18 @@
|
||||
|
||||
#define PARSER_STATE_LEN 256
|
||||
struct backend;
|
||||
struct addrinfo;
|
||||
typedef bool (*parser)(struct backend *, struct packet *);
|
||||
struct backend {
|
||||
enum peer_type type;
|
||||
struct peer peer;
|
||||
char id[UUID_LEN];
|
||||
int fd;
|
||||
char *node;
|
||||
char *service;
|
||||
struct addrinfo *addrs;
|
||||
struct addrinfo *addr;
|
||||
struct buf buf;
|
||||
char parser_state[PARSER_STATE_LEN];
|
||||
parser parser;
|
||||
};
|
||||
|
||||
|
||||
void backend_init(struct backend *);
|
||||
bool backend_connect(char *, char *, struct backend *, int);
|
||||
bool backend_read(struct backend *);
|
||||
struct backend *backend_new(char *node, char *service, int epoll_fd);
|
||||
|
||||
Reference in New Issue
Block a user