From: Samuel Thibault <samuel.thibault@gnu.org>
To: llyzs <llyzs.vic@gmail.com>
Cc: qemu-devel@nongnu.org, "Jan Kiszka" <jan.kiszka@siemens.com>,
"Marc-André Lureau" <marcandre.lureau@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] socket: fix blocking udp recvfrom.
Date: Thu, 28 Feb 2019 12:51:09 -0800 [thread overview]
Message-ID: <20190228205109.hmldtldbnlw3pnqq@function> (raw)
In-Reply-To: <CACxphuFGAODB_=X1fVFqJa=U14E_YSJMreWJcOgzdsooke1wxg@mail.gmail.com>
Hello,
llyzs, le jeu. 28 févr. 2019 19:59:12 +0800, a ecrit:
> Sometimes sorecvfrom() is called from slirp.c because revents == G_IO_IN,
> however inside sorecvfrom() function, ioctlsocket() returns 0 bytes available
> and recvfrom could be blocking indefinitely. This adds a non-blocking flag to
> recvfrom and checks data availability.
When ioctlsocket() returns 0 bytes available, we could as well just
immediately return, without even calling recvfrom. We could just move
that ioctlsocket call above the m_get() call, so we can just return
without having to clean up anything.
This however still looks weird. AFAIK, G_IO_IN means that we can make
one recv call and be sure that it won't block. Do you have an idea why
it wouldn't necessarily be the case?
Samuel
next prev parent reply other threads:[~2019-02-28 20:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-28 11:59 [Qemu-devel] [PATCH] socket: fix blocking udp recvfrom llyzs
2019-02-28 20:51 ` Samuel Thibault [this message]
2019-03-01 4:27 ` llyzs
2019-03-01 5:12 ` Samuel Thibault
2019-03-01 5:13 ` [Qemu-devel] [PATCHv2] slirp: check for ioctlsocket error and 0-length udp payload llyzs
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=20190228205109.hmldtldbnlw3pnqq@function \
--to=samuel.thibault@gnu.org \
--cc=jan.kiszka@siemens.com \
--cc=llyzs.vic@gmail.com \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).