godotengine / godotengine/godot

server_disconnected emits on client when authentication is failed

Open
#95,183 1 comment 0 reactions 0 assignees View on GitHub
bug topic:multiplayer
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: v4.0.beta17.official [c40020513], v4.1.4.stable.official [fe0e8e557], v4.2.2.stable.official [15073afe3], v4.3.rc2.official [3978628c6]

### System information

Godot v4.3.rc2 - Ubuntu 24.04 LTS 24.04 - X11 - GLES3 (Compatibility) - Mesa Intel(R) Graphics (ADL GT2) - 12th Gen Intel(R) Core(TM) i5-1235U (12 Threads)

### Issue description

`server_disconnected` signal emits on client when authenticating is failed, and I think this is not correct, because `connected_to_server` doesn't emit.

### Steps to reproduce

1. Set authenticate callback which rejects clients with `multiplayer.multiplayer_peer.disconnect_peer()` (if clients gets rejected with timeout, this also works).
2. On one game instance, create server.
3. On other game instance, try to connect.
4. Observe both `peer_authentication_failed` and `server_disconnected` emitted on client.

### Minimal reproduction project (MRP)

[mrp.zip](https://github.com/user-attachments/files/16505288/mrp.zip)
1. Run 2 instances.
2. On first, click "create".
3. On second, click "join".
4. Observe both `peer_authentication_failed` and `server_disconnected` emitted on client (visible in console).

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior with the attached MRP: run two instances, create a server, attempt to join with authentication rejected, and observe the client console. Trace the multiplayer peer authentication failure and server_disconnected signal flow; done means the client no longer receives server_disconnected when connected_to_server never emitted, while peer_authentication_failed remains observable.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.