Skip to content

Conversation

@kingster
Copy link
Member

No description provided.

…ck and sendError

- Add cleanup_complete check in timeoutCallback to prevent use-after-free
- Add exception handling in timeoutCallback and pingCallback
- Add cleanup_complete check in sendError before locking mutex
- Add exception handling when locking callback_mutex in sendError
- Cancel timeout_event and ping_event in disconnect() before cleanup
- Prevents crashes when timeoutCallback is called on destroyed object
… safety

- Add try-catch blocks around event_thread->join() in disconnect() to prevent crashes
- Add exception handling in both normal path and helper thread path
- Ensure event_thread is checked before deletion
- Add version markers for debugging (VietHQ version 1.1)
- Prevents crashes when joining threads that are being destroyed
…send

- Add cleanup_complete check at start of sendData() to prevent operations on destroyed object
- Add cleanup_complete check before and after bufferevent_lock() in sendData()
- Wrap bufferevent_lock/unlock in try-catch to handle destroyed bufferevent
- Add cleanup_complete check in send() before writing to evbuffer
- Wrap all evbuffer_add() calls in try-catch to prevent crashes
- Prevents crashes when sendData/send are called during object destruction
- Set cleanup_complete AFTER close() but BEFORE bufferevent_lock in disconnect()
- This prevents sendData() from locking bufferevent while disconnect() is running
- Add multiple cleanup_complete checks in sendData() before attempting lock
- Wrap bufferevent_lock in disconnect() with try-catch to handle destroyed bufferevent
- Prevents deadlock when multiple threads try to lock bufferevent during destruction
- Add cleanup_complete check at start of handleEvent() to prevent all operations when destroying
- Add cleanup_complete check before processing BEV_EVENT_ERROR to ignore Broken pipe after EOF
- Add cleanup_complete check before processing BEV_EVENT_EOF
- Wrap close callback invocation in try-catch to prevent exceptions from crashing
- Prevents crash when Broken pipe error occurs after connection is closed (EOF)
…struction

- Change from lock_guard to unique_lock with try_to_lock in sendError
- Prevents blocking or crash if callback_mutex is being destroyed
- Double-check cleanup_complete after acquiring lock
- Release lock before calling callback to avoid deadlock
- Set cleanup_complete BEFORE canceling events to ensure callbacks see flag
- Prevents crash when timeoutCallback calls sendError after object destruction
- Check for FreeSWITCH headers (SWITCH_LOG_DEBUG) to detect FreeSWITCH build
- Use switch_log_printf when FreeSWITCH is available instead of syslog/stdout
- Enable debug logs to appear in FreeSWITCH logs with mod_audio_stream prefix
- Fallback to syslog/stdout when not building with FreeSWITCH
- Allows WebSocketClient logs to be visible in FreeSWITCH console/logs
- Add log_info() function that always works (not dependent on LIBWSC_USE_DEBUG)
- Change disconnect() entry log from log_debug to log_info for visibility
- Change cleanup() logs from log_debug to log_info for visibility
- Change sendError cleanup check log from log_debug to log_info
- Logs will now appear in FreeSWITCH even without debug level enabled
- Add WebSocketClientWrapper.h and .cpp to replace libwsc WebSocketClient
- Integrate libwebsockets library for WebSocket client functionality
- Update CMakeLists.txt to find and link libwebsockets
- Maintain same interface as WebSocketClient for compatibility
@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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