Skip to content

Commit

Permalink
basichost: handle the SetProtocol error in NewStream (#2555)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored Sep 4, 2023
1 parent 9f14eb7 commit dce9424
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion p2p/host/basic/basic_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,9 @@ func (h *BasicHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.I
}

if pref != "" {
s.SetProtocol(pref)
if err := s.SetProtocol(pref); err != nil {
return nil, err
}
lzcon := msmux.NewMSSelect(s, pref)
return &streamWrapper{
Stream: s,
Expand Down

0 comments on commit dce9424

Please sign in to comment.