/// <summary> /// Sends an authentication failed packet to the client. /// </summary> /// <param name="client">Client.</param> /// <param name="error">Authentication error type.</param> /// <param name="reason">Authentication error reason.</param> /// <param name="disconnectClient">A boolean value that indicates if we disconnect the client or not.</param> private void AuthenticationFailed(ILoginClient client, ErrorType error, string reason, bool disconnectClient = true) { _logger.LogWarning($"Unable to authenticate user from {client.Socket.RemoteEndPoint}. Reason: {reason}"); _loginPacketFactory.SendLoginError(client, error); if (disconnectClient) { client.Disconnect(); } }