Conversation
5b3000f to
a919d07
Compare
|
A general fast comment here: if we don't rename |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
thanks! |
remove FuzzConn, FuzzConnFromConfig, FuzzConnAfter
It will be API-breaking anyway because I had to extract many packages. But if you think the renaming is unjustified, I can revert it to the "channels" concept. |
andynog
left a comment
There was a problem hiding this comment.
Overall looks good to me. Made some comments and suggestions. Also ran a few tests. Good job. 👍
|
|
||
| // GetChannels implements Reactor. | ||
| func (*Reactor) GetChannels() []*p2p.ChannelDescriptor { | ||
| // StreamDescriptors implements Reactor. |
There was a problem hiding this comment.
I was just trying to understand the semantics for the naming difference, why the ChannelDescriptor changed to StreamDescriptor. Looking at some related code, eg. in node/node.go CustomReactors seems there's a mixing of these semantics like
for _, chDesc := range reactor.StreamDescriptors() {
if !ni.HasChannel(chDesc.StreamID()) {
ni.Channels = append(ni.Channels, chDesc.StreamID())
}
}
Just want to understand the difference between channels and streams
There was a problem hiding this comment.
So, "channel" is what we were using before, but I don't know where this naming concept is coming from. Channels are not mentioned anywhere in TCP or multiplexed TCP.
Where's in QUIC, there's a direct concept of data streams. Hence, I've decided to change the name.
p2p/peer.go
Outdated
|
|
||
| return cmtconn.NewMConnectionWithConfig( | ||
| // filter out non-tcpconn.ChannelDescriptor streams | ||
| chDescs := make([]*tcpconn.ChannelDescriptor, 0, len(streams)) |
There was a problem hiding this comment.
should we pre-allocate capacity here? I'm wondering if most of the streams will be non-tcpconn, then maybe we don't pre-allocate. The GC will eventually kick-in but just a suggestion if it makes sense.
There was a problem hiding this comment.
This part will be refactored out later :)
| ) | ||
| } | ||
|
|
||
| func wrapPeer(c net.Conn, ni ni.NodeInfo, cfg peerConfig, socketAddr *na.NetAddress, mConfig tcpconn.MConnConfig) Peer { |
There was a problem hiding this comment.
Could you please add some context here ? e.g. comments why wrapPeer? I tried to check with the logic in the switch acceptRoutine and it seems this method changes the logic a little bit, I couldn't find logic related to persistence check in the previous acceptRoutine, having additional comments may provide more context for that. Thanks.
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
There was a problem hiding this comment.
just noticed that in the previous file, there was a cfg parameter and the outbound was set. I'm assuming this is not needed or was removed on purpose but just wanted to highlight here
cfg.outbound = true
|
nice job!! |
Closes #4301
This PR refactors the peer-to-peer (p2p) module by extracting the TCP transport into its own component, laying groundwork for potential QUIC transport integration. It introduces a breaking change to the Go API, particularly in the handling of peer connections and transport interfaces.
Important: no logic has been changed; just moving stuff and updating interfaces.
Changes
Public API
TransportinterfaceNew Go packages (extracted from
p2p)netaddress- network addressnodeinfo- node's infonodekey- ID of the nodetransport/tcp- TCP transportInternalized Go packages
fuzz- fuzzing connection#go-api-breaking