public NzbConnection(NzbServer server, int id) { ArgumentChecker.ThrowIfNull("server", server); _id = id; _server = server; _synchronizationObject = new ReaderWriterLockSlim(); _status = NzbConnectionStatus.Disconnected; _nntpParser = new NntpParser(this); this.Server = _server; }
public void AddServer(NzbServer server) { lock (server) { server.Connections.ForEach(con => { _connectionPool.AddConnection(con); _maxConnections++; }); } lock (this) { _servers.Add(server); _downloadQueue.SynchronizeWorkersWithConnectionPool(_maxConnections); } }
public void RemoveServer(NzbServer server) { lock (server) { server.Connections.ForEach(con => { con.Discard(); _maxConnections--; }); } lock (this) { _servers.Remove(server); _downloadQueue.SynchronizeWorkersWithConnectionPool(_maxConnections); } }