Esempio n. 1
0
        private ConnectionEntry OnConnectedInternal(SiloAddress address, Connection connection)
        {
            bool            acquiredConnectionLock = false;
            ConnectionEntry entry = default;

            lock (this.collectionLock)
            {
                try
                {
                    entry = this.GetOrCreateEntry(address, ref acquiredConnectionLock);

                    var newConnections = entry.Connections.Contains(connection) ? entry.Connections : entry.Connections.Add(connection);
                    return(this.connections[address] = entry.WithConnections(newConnections).WithLastFailure(default));
Esempio n. 2
0
        private ConnectionEntry OnConnectedInternal(SiloAddress address, Connection connection)
        {
            bool            acquiredConnectionLock = false;
            ConnectionEntry entry = default;

            lock (this.collectionLock)
            {
                try
                {
                    entry = this.GetOrCreateEntry(address, ref acquiredConnectionLock);

                    // Do not add a connection multiple times.
                    if (entry.Connections.Contains(connection))
                    {
                        return(entry);
                    }

                    return(this.connections[address] = entry.WithConnections(entry.Connections.Add(connection)).WithLastFailure(default));