Skip to content
This repository was archived by the owner on Jun 2, 2026. It is now read-only.

fix(socket): Properly cleanup Discord IPC socket on disconnect - #57

Merged
ImDevinC merged 1 commit into
ImDevinC:mainfrom
nirnx:main
Dec 26, 2025
Merged

fix(socket): Properly cleanup Discord IPC socket on disconnect#57
ImDevinC merged 1 commit into
ImDevinC:mainfrom
nirnx:main

Conversation

@nirnx

@nirnx nirnx commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Summary

  • Add close() method to backend to disconnect Discord client on shutdown
  • Fix sockets.py disconnect() to reset socket to None after closing
  • Add try/except around socket shutdown/close for robustness

Problem

When restarting StreamController without restarting Discord, the following error occurred:

failed to connect to socket /run/user/1000/discord-ipc-0, trying next socket.
[Errno 106] Transport endpoint is already connected

Root Cause

The disconnect() method in sockets.py was closing the socket but not resetting self.socket = None. When connect() was called again, it tried to reuse the closed socket object instead of creating a fresh one.

- Add close() method to backend to disconnect Discord client on shutdown
- Fix sockets.py disconnect() to reset socket to None after closing
- Add try/except around socket shutdown/close for robustness

This fixes the error that occurred when restarting StreamController:
"failed to connect to socket /run/user/1000/discord-ipc-0, trying next socket.
[Errno 106] Transport endpoint is already connected"
@ImDevinC

Copy link
Copy Markdown
Owner

Thanks for this!

@ImDevinC
ImDevinC merged commit 48499e8 into ImDevinC:main Dec 26, 2025
1 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants