Skip to content

Commit 668e19b

Browse files
committed
basichost: use multistream2
1 parent db25443 commit 668e19b

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,6 @@ require (
105105
gopkg.in/yaml.v3 v3.0.1 // indirect
106106
lukechampine.com/blake3 v1.4.1 // indirect
107107
)
108+
109+
// TODO: remove this when it's done
110+
replace github.com/multiformats/go-multistream => github.com/ppopth/go-multistream v0.0.0-20251117190159-82393f9eab2d

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ github.com/multiformats/go-multicodec v0.9.1/go.mod h1:LLWNMtyV5ithSBUo3vFIMaeDy
104104
github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew=
105105
github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U=
106106
github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM=
107-
github.com/multiformats/go-multistream v0.6.1 h1:4aoX5v6T+yWmc2raBHsTvzmFhOI8WVOer28DeBBEYdQ=
108-
github.com/multiformats/go-multistream v0.6.1/go.mod h1:ksQf6kqHAb6zIsyw7Zm+gAuVo57Qbq84E27YlYqavqw=
109107
github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8=
110108
github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU=
111109
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
@@ -156,6 +154,8 @@ github.com/pion/webrtc/v4 v4.1.2 h1:mpuUo/EJ1zMNKGE79fAdYNFZBX790KE7kQQpLMjjR54=
156154
github.com/pion/webrtc/v4 v4.1.2/go.mod h1:xsCXiNAmMEjIdFxAYU0MbB3RwRieJsegSB2JZsGN+8U=
157155
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
158156
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
157+
github.com/ppopth/go-multistream v0.0.0-20251117190159-82393f9eab2d h1:KHw0qkdg8VKva4gRFLbCrGfl4RsJ8iSvfLJx5M/TbfE=
158+
github.com/ppopth/go-multistream v0.0.0-20251117190159-82393f9eab2d/go.mod h1:sIFlNOs3fTbw+XPuWqQ0MgfxtPcVu5N8R5Xg5+H/bcE=
159159
github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q=
160160
github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0=
161161
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=

p2p/host/basic/basic_host.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,15 +477,16 @@ func (h *BasicHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.I
477477
return nil, err
478478
}
479479

480-
if h.supportProtocolAbbreviation(p) {
481-
// TODO: if the protocol ID abbreviation is supported, do something here.
482-
}
483-
484480
if pref != "" {
485481
if err := s.SetProtocol(pref); err != nil {
486482
return nil, err
487483
}
488-
lzcon := msmux.NewMSSelect(s, pref)
484+
var lzcon msmux.LazyConn
485+
if h.supportProtocolAbbreviation(p) {
486+
lzcon = msmux.NewMSSelect2(s, pref, pids)
487+
} else {
488+
lzcon = msmux.NewMSSelect(s, pref)
489+
}
489490
return &streamWrapper{
490491
Stream: s,
491492
rw: lzcon,

0 commit comments

Comments
 (0)