Skip to content

Commit

Permalink
Nits
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Apr 11, 2023
1 parent 7fd64c3 commit 70b49fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions p2p/host/basic/basic_host.go
Expand Up @@ -1013,6 +1013,8 @@ var wtComponent = ma.StringCast("/webtransport")
func inferWebtransportAddrsFromQuic(in []ma.Multiaddr) []ma.Multiaddr {
// We need to check if we are listening on the same ip+port for QUIC and WebTransport.
// If not, there's nothing to do since we can't infer anything.

// Count the number of QUIC addrs, this will let us allocate just once at the beginning.
quicAddrCount := 0
for _, addr := range in {
if _, lastComponent := ma.SplitLast(addr); lastComponent.Protocol().Code == ma.P_QUIC_V1 {
Expand Down
2 changes: 1 addition & 1 deletion p2p/host/basic/basic_host_test.go
Expand Up @@ -884,7 +884,7 @@ func TestInferWebtransportAddrsFromQuic(t *testing.T) {
min = append(min, ma.StringCast(addr))
}
outMa := inferWebtransportAddrsFromQuic(min)
outStr := make([]string, 0, len(tc.out))
outStr := make([]string, 0, len(outMa))
for _, addr := range outMa {
outStr = append(outStr, addr.String())
}
Expand Down

0 comments on commit 70b49fb

Please sign in to comment.