[pve-devel] [RFC PATCH] fix #3106: correctly queue incoming connections
Dietmar Maurer
dietmar at proxmox.com
Tue Nov 3 18:45:28 CET 2020
> > + Ok((sock, _addr)) => {
> > + sock.set_nodelay(true).unwrap();
> > + let _ = set_tcp_keepalive(sock.as_raw_fd(), PROXMOX_BACKUP_TCP_KEEPALIVE_TIME);
> > + let acceptor = Arc::clone(&acceptor);
> > + let mut sender = sender.clone();
> > +
> > + if accept_counter.load(Ordering::SeqCst) > MAX_PENDING_ACCEPTS {
> > + eprintln!("connection rejected - to many open connections");
> > + continue;
> > + }
> > + accept_counter.fetch_add(1, Ordering::SeqCst);
>
> We should think about making a counter guard for this sort of thing,
> because from this point onward we're not allowed to use `?` anywhere,
> which is quite annoying.
I wonder if we can simply use an Arc<bool> for that? The Arc already has
an atomic counter with deref on drop!
And we can query that counter with Arc::strong_count
What do you think?
More information about the pve-devel
mailing list