MirrorNetworking / Mirror

#1 Open Source Unity Networking Library
https://mirror-networking.com
MIT License
5.25k stars 775 forks source link

NetworkServer.dontListen improvements and fixes #3923

Closed miwarnec closed 1 month ago

miwarnec commented 1 month ago
  1. changes double negative 'dontListen=false' to 'listen=true'
  2. fixes #2536

MERGE, DONT SQUASH

miwarnec commented 1 month ago

for a simple solution, we could change OnTransprotConnectec to ignore connections while not listening

MrGadget1024 commented 1 month ago

for a simple solution, we could change OnTransprotConnectec to ignore connections while not listening

You'd need to call Transport.ClientDisconnect if listen == false so the transport kicks the connection off.

MrGadget1024 commented 1 month ago

This in NetworkServer::IsConnectionAllowed

if (dontListen)
{
    Debug.LogError($"Server not listening, client {connectionId} will be kicked");
    return false;
}
miwarnec commented 1 month ago

@MrGadget1024 pushed. no more shutdown. just not accepting connections. that should be the most simple solution here.

MrGadget1024 commented 1 month ago

@miwarnec Failing test

image

miwarnec commented 1 month ago

@miwarnec Failing test

image

fixed