Skip to content

server: Create peer netaddr during construction.#3625

Merged
davecgh merged 1 commit intodecred:masterfrom
davecgh:server_early_netaddr
Mar 3, 2026
Merged

server: Create peer netaddr during construction.#3625
davecgh merged 1 commit intodecred:masterfrom
davecgh:server_early_netaddr

Conversation

@davecgh
Copy link
Copy Markdown
Member

@davecgh davecgh commented Feb 26, 2026

The recent code that added v2 address support modified the way the net address that represents the remote peer address is handled to override the one returned from the base peer. As the author explained in the commit that made the change, it was the least intrusive way to integrate the new addresses. Unfortunately, the approach is rather inefficient because it involves creating the same object every time it's invoked.

This takes an entirely different approach to greatly simplify the handling by decoupling it from the peer package altogether. This will ultimately allow the NA method to be removed from the base peer completely which will also simplify its API.

With that in mind, this creates the network address once from the initial connection object prior to construction of the peer and stores it in the server peer instance. The base peer NA method is no longer used after this change and can be removed in a future commit.

@davecgh davecgh added this to the 2.2.0 milestone Feb 26, 2026
@davecgh davecgh force-pushed the server_early_netaddr branch 3 times, most recently from eb173bf to ecddc3a Compare February 26, 2026 23:22
Comment thread server.go Outdated
The recent code that added v2 address support modified the way the net
address that represents the remote peer address is handled to override
the one returned from the base peer.  As the author explained in the
commit that made the change, it was the least intrusive way to integrate
the new addresses.  Unfortunately, the approach is rather inefficient
because it involves creating the same object every time it's invoked.

This takes an entirely different approach to greatly simplify the
handling by decoupling it from the peer package altogether.  This will
ultimately allow the NA method to be removed from the base peer
completely which will also simplify its API.

With that in mind, this creates the network address once from the
initial connection object prior to construction of the peer and stores
it in the server peer instance.  The base peer NA method is no longer
used after this change and can be removed in a future commit.
@davecgh davecgh force-pushed the server_early_netaddr branch from ecddc3a to e03af10 Compare March 3, 2026 15:33
@davecgh davecgh merged commit e03af10 into decred:master Mar 3, 2026
33 checks passed
@davecgh davecgh deleted the server_early_netaddr branch March 3, 2026 15:51
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