Switch from epoll to libevent, to add OS X support.

This commit is contained in:
Ian Gulliver
2015-02-07 16:44:42 +01:00
parent 2c9b9f97de
commit 88c3c69e52
4 changed files with 64 additions and 98 deletions

View File

@@ -37,26 +37,6 @@ int main(int argc, char *argv[]) {
secret_key_file >> secret_key;
}
int fd = socket(PF_INET6, SOCK_STREAM, 0);
int optval = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof(optval));
struct sockaddr_in6 server_addr = {0};
server_addr.sin6_family = AF_INET6;
server_addr.sin6_addr = in6addr_any;
server_addr.sin6_port = htons(4990);
if (bind(fd, (struct sockaddr*) &server_addr, sizeof(server_addr))) {
perror("bind");
return 1;
}
if (listen(fd, 256)) {
perror("listen");
return 1;
}
CryptoPubServer server(fd, secret_key);
CryptoPubServer server(secret_key);
server.Loop();
}