Skip to content

Implement TCP connection (tcpConn)#390

Open
sirzooro wants to merge 1 commit into
pion:mainfrom
sirzooro:add_tcp_conn
Open

Implement TCP connection (tcpConn)#390
sirzooro wants to merge 1 commit into
pion:mainfrom
sirzooro:add_tcp_conn

Conversation

@sirzooro

@sirzooro sirzooro commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Add tcpConn type that implements transport.TCPConn / net.Conn.

  • Read / Write with in-order delivery using seqNum/ackNum.
  • Close with FIN/RST handling.
  • SetDeadline, SetReadDeadline, SetWriteDeadline.
  • Full unit tests covering connection lifecycle, data exchange, and teardown.

Split out from #375

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.69373% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.61%. Comparing base (0ccb39d) to head (7106641).

Files with missing lines Patch % Lines
vnet/tcp_conn.go 72.59% 58 Missing and 16 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #390      +/-   ##
==========================================
- Coverage   84.11%   83.61%   -0.51%     
==========================================
  Files          41       41              
  Lines        3356     3612     +256     
==========================================
+ Hits         2823     3020     +197     
- Misses        395      437      +42     
- Partials      138      155      +17     
Flag Coverage Δ
go 83.61% <72.69%> (-0.51%) ⬇️

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

☔ 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an initial vnet.TCPConn implementation intended to satisfy transport.TCPConn / net.Conn semantics inside the vnet simulator, along with unit tests for core I/O and teardown behaviors. It also standardizes timeout errors by switching to a shared errIOTimeout instance.

Changes:

  • Implement TCPConn read/write paths with simple seq/ack-based blocking semantics, plus close and deadline handling.
  • Add a comprehensive new tcp_conn_test.go suite covering reads, writes, deadlines, close behavior, and RST handling.
  • Replace per-call timeout error construction with a reusable errIOTimeout.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
vnet/tcp_conn.go Adds the TCPConn implementation (I/O, close, deadlines) and inbound segment handling.
vnet/tcp_conn_test.go Adds unit tests for TCPConn data flow, deadlines, shutdown, and RST behavior.
vnet/errors.go Introduces errIOTimeout global to replace newTimeoutError.
vnet/conn.go Updates UDPConn timeout path to use errIOTimeout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread vnet/tcp_conn.go
Comment thread vnet/tcp_conn.go
Comment thread vnet/tcp_conn.go
@sirzooro sirzooro force-pushed the add_tcp_conn branch 3 times, most recently from a02ddb6 to 7c48263 Compare July 14, 2026 19:22
@sirzooro sirzooro requested a review from Copilot July 14, 2026 19:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread vnet/tcp_conn.go
Comment thread vnet/tcp_conn.go
Comment thread vnet/tcp_conn.go
@sirzooro sirzooro force-pushed the add_tcp_conn branch 3 times, most recently from 0643a48 to 12d687d Compare July 14, 2026 19:58
@sirzooro sirzooro requested a review from Copilot July 14, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread vnet/tcp_conn.go
Comment thread vnet/tcp_conn.go Outdated
Comment thread vnet/tcp_conn.go
@sirzooro sirzooro requested a review from JoTurk July 14, 2026 20:18
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.

2 participants