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

Non-blocking IO #43

Merged
merged 7 commits into from
Nov 27, 2024
Merged

Non-blocking IO #43

merged 7 commits into from
Nov 27, 2024

Conversation

compscidr
Copy link
Owner

@compscidr compscidr commented Nov 27, 2024

Previously we were reading and writing from the socket on two different threads at the same time which led to deadlock quite often.

This switches the IO to use a selector following this guide: https://rox-xmlrpc.sourceforge.net/niotut/ where the selector is only ever modified by a single thread.

By default, we are always in read mode on the remote socket, and then when data is ready, we switch to read mode and write.

I also updated the jdk to java 21.

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 58 lines in your changes missing coverage. Please review.

Project coverage is 63.32%. Comparing base (de306d0) to head (5d3852c).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...c/main/kotlin/com/jasonernst/kanonproxy/Session.kt 76.15% 15 Missing and 16 partials ⚠️
...m/jasonernst/kanonproxy/tcp/AnonymousTcpSession.kt 58.97% 14 Missing and 2 partials ⚠️
...kotlin/com/jasonernst/kanonproxy/udp/UdpSession.kt 63.15% 5 Missing and 2 partials ⚠️
.../jasonernst/kanonproxy/BidirectionalByteChannel.kt 42.85% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #43      +/-   ##
============================================
+ Coverage     61.46%   63.32%   +1.85%     
- Complexity      196      221      +25     
============================================
  Files            14       15       +1     
  Lines          1783     1903     +120     
  Branches        263      283      +20     
============================================
+ Hits           1096     1205     +109     
+ Misses          529      526       -3     
- Partials        158      172      +14     
Flag Coverage Δ
libunittests 63.32% <71.42%> (+1.85%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@compscidr compscidr changed the title WiP: non-blocking IO Non-blocking IO Nov 27, 2024
@compscidr compscidr merged commit ce4c2c8 into main Nov 27, 2024
3 checks passed
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.

1 participant