fix(protocol): send disconnect packet when no servers available during login #764
+8
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a player connects but no backend servers are available, the proxy was closing the TCP connection without sending a disconnect packet. The client received no error message - just a dropped connection.
Root Cause
KickPlayerAsyncreturnedfalsewhen the player wasn't in authenticated phases (Play/Configuration/post-LoginSuccess), preventing disconnect packet transmission. The conditional checks were:The
IsLoggingInAsynccheck verified ifLoginSuccessPacketwas in the registry, which only occurs after successful login - not during early login failure scenarios.Changes
falseIsInLoginPhaseAsyncmethods (checked same registry asIsLoggingInAsyncsince both serverbound/clientbound Login mappings load simultaneously)Players now receive "Failed to find a server for you" message before disconnection.
Original prompt
It does kick me without any message. No even a single packet arrived to the client. It just closes TCP connection, but I expect disconnect packet with message.
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ForwardingSupport.Velocity.Services.ForwardingService event listener
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ForwardingSupport.Velocity.Services.ForwardingService event listener method OnPhaseChanged
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ForwardingSupport.Velocity.Services.ForwardingService event listener method OnMessageReceived
[19:38:31 VRB] [Void.Proxy.Plugins.Context.PluginAssemblyLoadContext] Loading System.Collections.Concurrent assembly into Void.Proxy.Plugins.ModsSupport.Forge.dll context
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ModsSupport.Forge.Services.HandshakeService event listener
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ModsSupport.Forge.Services.HandshakeService event listener method OnPlayerDisconnect
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ModsSupport.Forge.Services.HandshakeService event listener method OnServerboundHandshakeBuild
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ModsSupport.Forge.Services.HandshakeService event listener method OnLoginPluginMessageEvent
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ModsSupport.Forge.Services.HandshakeService event listener method OnMessageReceived
[19:38:31 VRB] [Void.Proxy.Events.EventService] Registering Void.Proxy.Plugins.ModsSupport.Forge.Services.HandshakeService event listener method OnPhaseChanged
[19:38:31 VRB] [Void.Proxy.Players.PlayerService] Player 10.42.4.0:42521 connecting
[19:38:31 VRB] [Void.Proxy.Links.LinkService] Looking for a server for 10.42.4.0:42521 player
[19:38:31 VRB] [Void.Proxy.Links.LinkService] Connecting 10.42.4.0:42521 player to a args-server-1 server
[19:38:31 VRB] [Void.Proxy.Plugins.Common.Network.Channels.Services.SimpleMinecraftChannelBuilderService] Searching for channel builder for a 10.42.4.0:42521 player
[19:38:31 VRB] [Void.Proxy.Events.EventService] Invoking SearchChannelBuilderEvent event
[19:38:31 VRB] [Void.Proxy.Plugins.Context.PluginAssemblyLoadContext] Loading System.Linq assembly into Void.Proxy.Plugins.ProtocolSupport.Java.v1_7_2_to_1_12_2.dll context
[19:38:31 VRB] [Void.Proxy.Plugins.Context.PluginAssemblyLoadContext] Loading System.Linq assembly into Void.Proxy.Plugins.ProtocolSupport.Java.v1_13_to_1_20_1.dll context
[19:38:31 VRB] [Void.Proxy.Plugins.Context.PluginAssemblyLoadContext] Loading System.Linq assembly into Void.Proxy.Plugins.ProtocolSupport.Java.v1_20_2_to_latest.dll context
[19:38:31 VRB] [Void.Proxy.Events.EventService] Completed invoking SearchChannelBuilderEvent event
[19:38:31 WRN] [Void.Proxy.Plugins.Common.Network.Channels.Services.SimpleMinecraftChannelBuilderService] Channel builder not found for a 10.42.4.0:42521 player
[19:38:31 VRB] [Void.Proxy.Plugins.Common.Network.Channels.Services.SimpleMinecraftChannelBuilderService] Building channel for a 10.42.4.0:42521 player
[19:38:31 VRB] [Void.Proxy.Plugins.Common.Network.Channels.Services.SimpleMinecraftChannelBuilderService] Client 10.42.4.0:42521 is using SimpleMinecraftChannel channel implementation
[19:38:31 VRB] [Void.Proxy.Events.EventService] Invoking ChannelCreatedEvent event
[19:38:31 VRB] [Void.Proxy.Events.EventService] Completed invoking ChannelCreatedEvent event
[19:38:31 VRB] [Void.Proxy.Plugins.Common.Network.Channels.Services.SimpleMinecraftChannelBuilderService] Building channel for a args-server-1 server
[19:38:31 WRN] [Void.Proxy.Links.LinkService] Player 10.42.4.0:42521 cannot connect to a args-server-1 server because it is unavailable: Name or service not known
[19:38:31 VRB] [Void.Proxy.Links.LinkService] Connecting 10.42.4.0:42521 player to a args-server-2 server
[19:38:31 VRB] [Void.Proxy.Plugins.Common.Network.Channels.Services.SimpleMinecraftChannelBuilderService] Building channel for a args-server-2 server
[19:38:31 WRN] [Void.Proxy.Links.LinkService] Player 10.42.4.0:42521 cannot connect to a args-server-2 server because it is unavailable: Name or service not known
[19:38:31 VRB] [Void.Proxy.Players.PlayerService] Kicking player 10.42.4.0:42521
[19:38:31 VRB] [Void.Proxy.Events.EventService] Invoking PlayerKickEvent event
[19:38:31 VRB] [Void.Proxy.Events.EventService] Completed invoking PlayerKickEvent event
[19:38:31 VRB] [Void.Proxy.Events.EventService] Invoking PlayerDisconnectedEvent event
[19:38:31 INF] [Void.Proxy.Players.PlayerService] Player 10.42.4.0:42521 disconnected
[19:38:31 VRB] [Void.Proxy.Events.EventService] Unregistering Void.Proxy.Plugins.ForwardingSupport.Velocity.Services.ForwardingService event listener
[19:38:31 VRB] [Void.Proxy.Events.EventService] Unregistering Void.Proxy...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.