-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server with db #15
base: main
Are you sure you want to change the base?
Server with db #15
Conversation
Пока еще не дописал и не затестил
uml для базы данных
Вернул параметризированный опциональный конструктор
но насчет асинхронности тут вопрос стоит, потому что напрягает функция accept
fix require
…dmade Async udp server handmade
#include <optional> | ||
#include "url_dispatcher.hpp" | ||
|
||
using udp = boost::asio::ip::udp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше выделить в отдельный namespace или вообще не использовать using в hpp файлах
_socket, | ||
_streambuf, | ||
[self = shared_from_this()]( | ||
boost::system::error_code error, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
такие большие функции лучше выносить в методы класса
void async_accept() { | ||
_socket.emplace(_io_context); | ||
|
||
_acceptor.async_accept(*_socket, [&](boost::system::error_code error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше явно перечислять захват
class UrlDispatcher { | ||
public: | ||
UrlDispatcher() : urls() { | ||
std::shared_ptr<UserView> user_v(new UserView()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make_shared
public: | ||
DatabaseTable(const std::string&); | ||
|
||
~DatabaseTable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
virtual
|
||
DatabaseTable::DatabaseTable(const std::string &tableName) : tableName(tableName) | ||
{ | ||
db = new pqxx::connection( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RAII
No description provided.