36 lines
676 B
C++
36 lines
676 B
C++
#ifndef SERVER_H
|
|
#define SERVER_H
|
|
|
|
#include "Connection.h"
|
|
#include "Util/Util.h"
|
|
#include <asio.hpp>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
|
|
namespace MailServer {
|
|
|
|
class Server
|
|
{
|
|
public:
|
|
Server(asio::io_service& ioService, unsigned short port, const std::string& path, const std::string& url);
|
|
|
|
private:
|
|
void StartSignalWait();
|
|
void HandleSignalWait();
|
|
void StartAccept();
|
|
void HandleAccept(const asio::error_code& ec);
|
|
|
|
asio::io_service& m_ioService;
|
|
asio::signal_set m_signal;
|
|
asio::ip::tcp::acceptor m_acceptor;
|
|
asio::ip::tcp::socket m_socket;
|
|
std::shared_ptr<Connection> m_connection;
|
|
|
|
Util::Context m_context;
|
|
};
|
|
|
|
} // namespace MailServer
|
|
|
|
#endif // SERVER_H
|