public inbox for [email protected]
 help / color / mirror / Atom feed
From: "robert.j.graham" <[email protected]>
To: "[email protected]" <[email protected]>
Subject: Best way to continually discard incoming socket data
Date: Thu, 17 Jun 2021 10:38:06 +0000	[thread overview]
Message-ID: <FepzOp21D3FNjLor4XObZ0-0m2tiUlNcI99eIpTZsRAfLgPW0FRyrDTRAC2_JamKECcJi8NFxbCKl-VXixV7vsPZccaZw27VbYgun-EKEQ4=@protonmail.com> (raw)

I wish to be able to discard all incoming data on a socket for some period as efficiently as possible, while still being able to send data on the socket. I think conceptually what I would want is a new socket flag, say, SO_RCVDISCARD, that would just as early as possible in the network stack discard any incoming data after enabled (and not show read readiness on epoll, etc). What I want to avoid is bouncing back and forth from kernel to userland just to discard the data, even if we can avoid the actual data copying the systems calls to continually be notified and instruct the kernel to discard don't make sense.

I've been trying to understand what might be the best way to achieve something similar in modern Linux. Would it be something like submitting a bunch (chain?) of recv()s with MSG_TRUNC on an io_uring, or some sort of splice(), IORING_OP_SPLICE, etc. There are a lot of different facilities available and it seems like a pretty straightforward task, so I'm sure there must be a fairly simple and efficient way, it's just not immediately clear to me what the best approach might be.

Thanks!

                 reply	other threads:[~2021-06-17 10:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='FepzOp21D3FNjLor4XObZ0-0m2tiUlNcI99eIpTZsRAfLgPW0FRyrDTRAC2_JamKECcJi8NFxbCKl-VXixV7vsPZccaZw27VbYgun-EKEQ4=@protonmail.com' \
    [email protected] \
    [email protected] \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox