madsim-rs / madsim

Magical Deterministic Simulator for distributed systems in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Peer address of TCP connection

huang-jl opened this issue · comments

Issue

For now, when an endpoint accepts a connection, it will wait for the peer to send the real peer address (i.e. binding address). Later the endpoint will save this real peer address instead of the socket's remote address:

https://github.com/madsys-dev/madsim/blob/5a7a858547cc350408ec9f78261062295c3fcca8/madsim/src/std/net/tcp.rs#L81-L99

However, for example, when two endpoints R1 and R2 want to connect to S, R1 and R2 may bind to the same address like 0.0.0.0:xxxx. In this situation, S cannot distinguishes R1 and R2's connection.