closing stream removes it from stream manager as well, so it doesn't need to remove it on caller function (#4606)

pull/4608/head
Gheis Mohammadi 10 months ago committed by GitHub
parent f57691047b
commit 00734e2f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      p2p/stream/protocols/sync/protocol.go

@ -271,8 +271,6 @@ func (p *Protocol) RemoveStream(stID sttypes.StreamID) {
if exist && st != nil {
//TODO: log this incident with reason
st.Close()
// stream manager removes this stream from the list and triggers discovery if number of streams are not enough
p.sm.RemoveStream(stID) //TODO: double check to see if this part is needed
p.logger.Info().
Str("stream ID", string(stID)).
Msg("stream removed")
@ -290,8 +288,6 @@ func (p *Protocol) StreamFailed(stID sttypes.StreamID, reason string) {
Msg("stream failed")
if st.FailedTimes() >= MaxStreamFailures {
st.Close()
// stream manager removes this stream from the list and triggers discovery if number of streams are not enough
p.sm.RemoveStream(stID) //TODO: double check to see if this part is needed
p.logger.Warn().
Str("stream ID", string(st.ID())).
Msg("stream removed")

Loading…
Cancel
Save