posix - Ignore data coming in to TCP socket -
some protocols http can specify message length, send (possibly long) message. no other messages can received while message being sent (something http/2.0 tried solve) if decide ignore message, can't continue waiting messages , not pull data.
normally read() length of message repeatedly junk buffer , ignore bytes. involves copying possibly millions of bytes kernelspace userspace (at 1 copy per memory page, not millions of copies). isn't there way tell kernel discard bytes instead of providing them?
it seemed obvious question, answer i've been able come oddly resource heavy, either using splice() dump bytes pipe , seeking pipe 0, or opening "/dev/null" , using sendfile() send bytes there. that, , reserve (single) file descriptor flushing data out of clogged connections, without reading, isn't there a... ignore(descriptor, length) function?
Comments
Post a Comment