private string FormatConnectionRow(IRavenfallConnection connection) { var sb = new StringBuilder(); sb.Append(connection.InstanceId); sb.Append("\t"); sb.Append(connection.EndPointString); if (connection.Session != null) { sb.Append("\t"); sb.Append(connection.Session.UserId); sb.Append("\t"); sb.Append(connection.Session.Name); sb.Append("\t"); sb.Append(connection.Session.Created); } return(sb.ToString()); }
public void OnClientDisconnected(IRavenfallConnection connection) { lock (connectionMutex) { connection.OnSessionInfoReceived -= Connection_OnSessionInfoReceived; if (connection.Session != null) { sessionManager.Remove(connection.Session); } connections.Remove(connection); foreach (var badConnection in connections.Where(x => x.EndPointString == "Unknown").ToArray()) { try { badConnection.Dispose(); } catch { } connections.Remove(badConnection); } logger.LogDebug("[" + connection.EndPointString + "] Ravenfall client disconnected."); } }