Make epoll_fd global as a concession to clarity. Handle client disconnection even when silent.
This commit is contained in:
10
common.h
10
common.h
@@ -2,19 +2,23 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/epoll.h>
|
||||
|
||||
|
||||
//////// peer
|
||||
|
||||
// All specific peer structs must be castable to this.
|
||||
struct peer;
|
||||
typedef void (*peer_event_handler)(struct peer *, int epoll_fd);
|
||||
typedef void (*peer_event_handler)(struct peer *);
|
||||
struct peer {
|
||||
int fd;
|
||||
peer_event_handler event_handler;
|
||||
};
|
||||
void peer_epoll_add(struct peer *, int, uint32_t);
|
||||
void peer_epoll_del(struct peer *, int);
|
||||
extern int epoll_fd;
|
||||
void peer_init();
|
||||
void peer_epoll_add(struct peer *, uint32_t);
|
||||
void peer_epoll_del(struct peer *);
|
||||
void peer_loop();
|
||||
|
||||
|
||||
//////// buf
|
||||
|
||||
Reference in New Issue
Block a user