Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KCP max connections reached does not work as intended. #3591

Closed
JesusLuvsYooh opened this issue Aug 29, 2023 · 3 comments
Closed

KCP max connections reached does not work as intended. #3591

JesusLuvsYooh opened this issue Aug 29, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JesusLuvsYooh
Copy link
Contributor

JesusLuvsYooh commented Aug 29, 2023

Describe the bug
KCP Client does not 'disconnect' upon attempting to join a full server.
It gets stuck on connecting UI until timeout is reached (10,000ms).
Works as expected with Telepathy.

[IMPORTANT] How can we reproduce the issue, step by step:
Have 2 editors open, tanks example, set max connections on NetworkManager to 1.
Set KCPTransport logs to true.
StartHost, then StartClient on other editor.

Expected behavior
Client gets some sort of callback straight away, to say failed to connect, rather than waiting for 10s timeout to kick in.

Desktop (please complete the following information):
Mac, Unity 2021, Any of latest Mirrors.

Additional context Screenshots
Further info/discussions in Discord.

Notes from Ninja:
Hard to say. Should be client. I can't tell if client received the disconnect message or not, and just wait for handshake.
Or is it server disconnects too soon and does not even send the handshake (if on same batch or something).
I haven't looked at it close up. if server does (receive handshake, send handshake, add connection, on connect, disconnect, as per the logs), and the disconnect destroys the connection immediately while handshake messages are queued to end of frame, then might be an issue? pure guess at this stage, didn't even look at code.

@MrGadget1024 MrGadget1024 added the bug Something isn't working label Jan 2, 2024
@miwarnec
Copy link
Collaborator

miwarnec commented Jan 3, 2024

update 2024:
2024-01-03 - 10-44-33@2x

@miwarnec
Copy link
Collaborator

miwarnec commented Jan 3, 2024

SendDisconnect is called, but it doesn't go through.
forcing with flush+update+sleep does work:
2024-01-03 - 11-54-26@2x

just need a better solution

miwarnec added a commit to MirrorNetworking/kcp2k that referenced this issue Jan 3, 2024
…res several unreliable messages instead of sending reliable. Fixes disconnect message not going through if the connection is closed & removed immediately after.
miwarnec added a commit to MirrorNetworking/kcp2k that referenced this issue Jan 3, 2024
…res several unreliable messages instead of sending reliable. Fixes disconnect message not going through if the connection is closed & removed immediately after.
miwarnec added a commit to MirrorNetworking/kcp2k that referenced this issue Jan 3, 2024
…res several unreliable messages instead of sending reliable. Fixes disconnect message not going through if the connection is closed & removed immediately after.
@miwarnec
Copy link
Collaborator

miwarnec commented Jan 3, 2024

fix is on kcp repo.
it now detects the disconnect immediately.
still shows a few warnings, but that's for next few days.

2024-01-03 - 14-16-30@2x

miwarnec added a commit that referenced this issue Jan 3, 2024
- added [KCP] to all log messages
- fix: #3704 remove old fix for #2353 which caused log spam and isn't needed anymore since the
  original Mirror issue is long gone
- fix: KcpClient.RawSend now returns if socket wasn't created yet
- fix: #3591 KcpPeer.SendDisconnect now rapid
  fires several unreliable messages instead of sending reliable. Fixes disconnect message not
  going through if the connection is closed & removed immediately after.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants