-
Notifications
You must be signed in to change notification settings - Fork 99
MINIFICPP-2701 ListenUDP udp.sender.port property #2084
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,9 +47,13 @@ class Server { | |
| bool queueEmpty() { | ||
| return concurrent_queue_.empty(); | ||
| } | ||
| bool tryDequeue(utils::net::Message& received_message) { | ||
| return concurrent_queue_.tryDequeue(received_message); | ||
| std::optional<utils::net::Message> tryDequeue() { | ||
| return concurrent_queue_.tryDequeue(); | ||
| } | ||
| Server(const Server&) = delete; | ||
| Server(Server&&) = delete; | ||
| Server& operator=(const Server&) = delete; | ||
| Server& operator=(Server&&) = delete; | ||
| virtual ~Server() { | ||
|
Comment on lines
+53
to
57
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rule of 5 (same with TcpClient and NetworkListenerProcessor) |
||
| stop(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,14 +147,17 @@ class GetTCP : public core::ProcessorImpl { | |
| std::optional<size_t> max_message_size, | ||
| std::vector<utils::net::ConnectionId> connections, | ||
| std::shared_ptr<core::logging::Logger> logger); | ||
|
|
||
| TcpClient(const TcpClient&) = delete; | ||
| TcpClient(TcpClient&&) = delete; | ||
| TcpClient& operator=(const TcpClient&) = delete; | ||
| TcpClient& operator=(TcpClient&&) = delete; | ||
| ~TcpClient(); | ||
|
|
||
| void run(); | ||
| void stop(); | ||
|
|
||
| bool queueEmpty() const; | ||
| bool tryDequeue(utils::net::Message& received_message); | ||
| std::optional<utils::net::Message> tryDequeue(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optional return values are cleaner than status bool return + conditionally assigned out param, plus it allows us to remove the default empty state from the possible states of the class, simplifying code. |
||
|
|
||
| private: | ||
| asio::awaitable<void> doReceiveFrom(const utils::net::ConnectionId& connection_id); | ||
|
|
||
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.
the old default constructor left a few members uninitialized. It used to be needed because objects were assigned from an "empty" state through out params. Refactored those instances, so that no more default constructed "empty" messages are necessary.