Skip to content
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

fix: epoll socket async chaining and refactor #374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kostasrim
Copy link
Contributor

Fixes the problem described in dragonflydb/dragonfly#4498 and here dragonflydb/dragonfly#4498 (comment)

  • fix async chaining
  • small refactor

@kostasrim
Copy link
Contributor Author

kostasrim commented Jan 23, 2025

@romange Fixes the test case as well in DF. I could add a test here but that's something I will be doing anyway when I push my AsyncWrite/AsyncRead on the tls socket.

delete async_request;
async_request = nullptr;
if (is_send)
async_write_pending_ = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause lambdas can't capture and use bitfields 😮‍💨

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 50.00000% with 18 lines in your changes missing coverage. Please review.

Project coverage is 77.92%. Comparing base (d30de86) to head (87773d8).
Report is 144 commits behind head on master.

Files with missing lines Patch % Lines
util/fibers/epoll_socket.cc 50.00% 18 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #374      +/-   ##
==========================================
+ Coverage   77.60%   77.92%   +0.31%     
==========================================
  Files         103      108       +5     
  Lines        7824     8972    +1148     
==========================================
+ Hits         6072     6991     +919     
- Misses       1752     1981     +229     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

delete async_read_req_;
async_read_req_ = nullptr;
async_read_pending_ = 0;
auto body = [&ec, this](bool is_send) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it captures this, please make it a member function that returns error_code.

@@ -166,22 +166,18 @@ bool EpollSocket::AsyncReq::Run(int fd, bool is_send) {
res = is_send ? sendmsg(fd, &msg, MSG_NOSIGNAL) : recvmsg(fd, &msg, 0);

if (res > 0) {
cb(res);
return true;
return {true, res};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason for moving cb() outside of AsyncReq::Run?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants