-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSQLiteSocket.h
More file actions
36 lines (25 loc) · 860 Bytes
/
SQLiteSocket.h
File metadata and controls
36 lines (25 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// Created by Miroslav Baudys on 02/03/2018.
//
#ifndef SQLITE_SERVER_SQLITESOCKET_H
#define SQLITE_SERVER_SQLITESOCKET_H
#include <queue>
#include "Socket.h"
#include "IRequestHandler.h"
class SQLiteSocket final : public Socket, public std::enable_shared_from_this<SQLiteSocket> {
using OutPackets = std::queue<std::unique_ptr<IResponse> >;
public:
explicit SQLiteSocket(boost::asio::io_context &service, boost::asio::ip::tcp::socket socket);
~SQLiteSocket() override;
//MARK: Socket
void do_read() override;
private:
void send_response(std::unique_ptr<IResponse> response);
void do_write(const std::unique_ptr<IResponse> &response);
private:
uint32_t m_packet_size;
std::string m_request;
std::unique_ptr<IRequestHandler> m_handler;
OutPackets m_out_packets;
};
#endif //SQLITE_SERVER_SQLITESOCKET_H