async Task ConnectionAcceptedAsync(NetworkConnectionToClient conn) { if (LogFilter.Debug) { Debug.Log("Server accepted client:" + conn); } // are more connections allowed? if not, kick // (it's easier to handle this in Mirror, so Transports can have // less code and third party transport might not do that anyway) // (this way we could also send a custom 'tooFull' message later, // Transport can't do that) if (connections.Count >= MaxConnections) { conn.Disconnect(); if (LogFilter.Debug) { Debug.Log("Server full, kicked client:" + conn); } return; } // add connection AddConnection(conn); // let everyone know we just accepted a connection Connected.Invoke(conn); // now process messages until the connection closes try { await conn.ProcessMessagesAsync(); } catch (Exception ex) { Debug.LogException(ex); } finally { OnDisconnected(conn); } }
protected void ServerReject(NetworkConnectionToClient conn) { conn.Disconnect(); }