Skip to content

add tcp protocol - #27

Open
marverlous811 wants to merge 5 commits into
8xFF:mainfrom
marverlous811:add-tcp-protocol
Open

marverlous811 wants to merge 5 commits into
8xFF:mainfrom
marverlous811:add-tcp-protocol

Conversation

@marverlous811

Copy link
Copy Markdown

What

This PR adds TCP protocol for the MIO backend

Change

The significant change is file src/backend/mio.rs, which adds logic for TCP protocol.

  • I created TcpListenerContainer to keep the TCP listener. If one connection is connected to the TCP listener, it will save TcpStreamContainer inside it.
  • Because each connection needs to register with the poll as a unique event source, I added an addr_seed_to_token function to create its unique token. That function will generate a token by using the listener port and its connection seed (incrementally when the listener has a new connection).

How to test

  • exec RUST_MIN_STACK=6400000 RUST_LOG=info cargo run --example tcp_echo_server command to start the TCP server.
  • using the telnet command to connect to that TCP server as a client.

QA

  • Why will the event_buffer pop in the next tick instead of instantly after it is processed?

@codecov

codecov Bot commented Mar 4, 2024 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.82759% with 70 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@10f6b9e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/backend/mio.rs 76.41% 50 Missing ⚠️
src/task.rs 0.00% 20 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #27   +/-   ##
=======================================
  Coverage        ?   52.40%           
=======================================
  Files           ?       13           
  Lines           ?     1374           
  Branches        ?        0           
=======================================
  Hits            ?      720           
  Misses          ?      654           
  Partials        ?        0           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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