Skip to content

fix: improve callback safety in WebSocket and DataChannel wrappers #2

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

pranavkonde
Copy link

Enhance callback safety and memory management

Improve callback handling and memory safety in WebSocket and DataChannel wrappers by replacing dangerous reference captures with value captures and implementing weak_ptr pattern for safe object lifetime tracking. Add std::enable_shared_from_this for proper shared pointer support across the wrapper classes. Address potential use-after-free issues in callbacks and enhance thread safety through proper pointer management and callback lifetime handling. These changes significantly reduce the risk of dangling references and memory-related issues in asynchronous operations.

Copy link
Collaborator

@achingbrain achingbrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this. This repo is a temporary fork of node-datachannel that incorporates murat-dogan/node-datachannel#256

To avoid this repo getting too out of sync with the upstream repo, please can you PR your changes to murat-dogan/node-datachannel then we'll integrate them here after merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants