Skip to content
Snippets Groups Projects
Commit f48e6ff6 authored by Leon Dietrich's avatar Leon Dietrich
Browse files

chg: Working on libev integration withion async_socket

parent 877d158d
No related branches found
No related tags found
No related merge requests found
#pragma once #pragma once
#include <ev++.h>
#include <functional> #include <functional>
#include <memory> #include <memory>
...@@ -20,12 +22,18 @@ private: ...@@ -20,12 +22,18 @@ private:
accept_handler_type on_accept; accept_handler_type on_accept;
error_handler_type on_error; error_handler_type on_error;
ev::io io;
public: public:
async_server_socket(auto_fd&& fd) : socket(std::forward(fd)) { async_server_socket(auto_fd&& fd) : socket(std::forward(fd)) {
// Add this socket to libev ... // This constructor got a constructed socket as an argument
// and forwards it to libev
io.set<async_server_socket, &async_server_socket::get_accept_handler()>(this);
io.start(this->socket, ev::READ);
} }
~async_server_socket() { ~async_server_socket() {
// Remove this socket from libev ... // Remove this socket from libev ...
io.stop();
} }
public: public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment