[PR #3050] [MERGED] Leave a server at once instead of freezing for about 20 seconds #4766

Closed
opened 2026-11-03 05:07:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3050
Author: @kacpherek
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: fix/disconnect-no-wait


📝 Commits (1)

  • a5ee1e5 Leave a server at once instead of waiting for the reader thread

📊 Changes

1 file changed (+5 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/net.rs (+5 -3)

📄 Description

What and why

  • Reported on Discord: clicking Disconnect on a multiplayer server froze the game for about 20 seconds, with Windows showing "Not Responding" over the pause menu.
  • Session::disconnect shut the socket down and then joined the network thread on the render thread. On Windows a socket shutdown doesn't wake a recv that's already waiting in another thread, so the join lasted until the server dropped the connection.
  • Now the socket is shut down and the thread is left to finish on its own, as vanilla does: Connection.disconnect closes the channel and the game goes on. The thread holds nothing the game still uses: the writer is already taken, and its events go to a receiver that's dropped with the session.

Vanilla reference

Minecraft.disconnect -> Connection.disconnect: channel.close() without waiting for it to finish.

Self-check

fmt passes. Built and tested by this pull request's checks. Not run in game.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3050 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/disconnect-no-wait` --- ### 📝 Commits (1) - [`a5ee1e5`](https://github.com/horizon-rust/horizon/commit/a5ee1e588cde2c1760d3fb07a44c8dd98792d25d) Leave a server at once instead of waiting for the reader thread ### 📊 Changes **1 file changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/net.rs` (+5 -3) </details> ### 📄 Description ## What and why - Reported on Discord: clicking Disconnect on a multiplayer server froze the game for about 20 seconds, with Windows showing "Not Responding" over the pause menu. - `Session::disconnect` shut the socket down and then joined the network thread on the render thread. On Windows a socket shutdown doesn't wake a `recv` that's already waiting in another thread, so the join lasted until the server dropped the connection. - Now the socket is shut down and the thread is left to finish on its own, as vanilla does: `Connection.disconnect` closes the channel and the game goes on. The thread holds nothing the game still uses: the writer is already taken, and its events go to a receiver that's dropped with the session. ## Vanilla reference `Minecraft.disconnect` -> `Connection.disconnect`: `channel.close()` without waiting for it to finish. ## Self-check fmt passes. Built and tested by this pull request's checks. Not run in game. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:46 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4766
No description provided.