all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [RFC PATCH] fix #3106: correctly queue incoming connections
Date: Wed, 4 Nov 2020 06:37:12 +0100 (CET)	[thread overview]
Message-ID: <1080743137.733.1604468232474@webmail.proxmox.com> (raw)
In-Reply-To: <641732415.729.1604425529102@webmail.proxmox.com>

Answering myself, this works as expected.

I now simply use Arc::new(()) to count references.

> On 11/03/2020 6:45 PM Dietmar Maurer <dietmar@proxmox.com> wrote:
> 
>  
> > > +                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?




      reply	other threads:[~2020-11-04  5:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 12:26 Dietmar Maurer
2020-11-03 12:51 ` Dominik Csapak
2020-11-03 13:05 ` Wolfgang Bumiller
2020-11-03 13:25   ` Dietmar Maurer
2020-11-03 14:15     ` Wolfgang Bumiller
2020-11-03 15:54       ` Dietmar Maurer
2020-11-03 17:45   ` Dietmar Maurer
2020-11-04  5:37     ` Dietmar Maurer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1080743137.733.1604468232474@webmail.proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=w.bumiller@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal