Content-Length: 267573 | pFad | http://github.com/paritytech/litep2p/pull/296/files/a756ebf07a399a20fa5c239e981d91dd8473cf11

45 notification: Fix memory leak of pending substreams by lexnv · Pull Request #296 · paritytech/litep2p · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notification: Fix memory leak of pending substreams #296

Merged
merged 4 commits into from
Dec 3, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions src/protocol/notification/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,18 +435,33 @@ impl NotificationProtocol {
},
);
}
// user either initiated an outbound substream or an outbound substream was
// opened/being opened as a result of an accepted inbound substream but was not
// yet fully open
// User initiated an outbound substream but the connection was closed before the
// substream was fully open.
// To have consistent state tracking in the user protocol, substream rejection
// must be reported to the user.
(OutboundState::OutboundInitiated { substream }, _) => {
tracing::debug!(
target: LOG_TARGET,
?peer,
protocol = %self.protocol,
"connection closed outbound substream initiated ",
);
// We need to remove this state to avoid a memory leak.
self.pending_outbound.remove(&substream);

self.event_handle
.report_notification_stream_open_failure(
peer,
NotificationError::Rejected,
)
.await;
}
// An outbound substream was opened/being opened as a result of an accepted
// inbound substream but was not yet fully open.
//
// to have consistent state tracking in the user protocol, substream rejection
// must be reported to the user
(
OutboundState::OutboundInitiated { .. }
| OutboundState::Negotiating
| OutboundState::Open { .. },
_,
) => {
// To have consistent state tracking in the user protocol, substream rejection
// must be reported to the user.
(OutboundState::Negotiating | OutboundState::Open { .. }, _) => {
tracing::debug!(
target: LOG_TARGET,
?peer,
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/paritytech/litep2p/pull/296/files/a756ebf07a399a20fa5c239e981d91dd8473cf11

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy