First integration almost done. BOLT still doesn't work as expected, problem is only serialization order.

This commit is contained in:
Marko Budiselic
2016-08-11 04:47:30 +01:00
parent 35d8f6d7ab
commit 93b174afd7
94 changed files with 430 additions and 285 deletions

View File

@@ -0,0 +1,43 @@
#pragma once
#include "io/network/stream_reader.hpp"
namespace io
{
template <class Derived>
class Server : public EventListener<Derived>
{
public:
Server(Socket&& socket) : socket(std::forward<Socket>(socket))
{
event.data.fd = this->socket;
event.events = EPOLLIN | EPOLLET;
this->listener.add(this->socket, &event);
}
void on_close_event(Epoll::Event& event)
{
::close(event.data.fd);
}
void on_error_event(Epoll::Event& event)
{
::close(event.data.fd);
}
void on_data_event(Epoll::Event& event)
{
if(UNLIKELY(socket != event.data.fd))
return;
this->derived().on_connect();
}
protected:
Epoll::Event event;
Socket socket;
};
}