From: Fabien Chevalier <fchevalier@silicom.fr>
To: Johan Hedberg <johan.hedberg@nokia.com>,
Marcel Holtmann <marcel@holtmann.org>
Cc: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [PATCH] Fix bogus avdtp error codes management
Date: Tue, 18 Sep 2007 14:00:04 +0200 [thread overview]
Message-ID: <46EFBDC4.3040506@silicom.fr> (raw)
In-Reply-To: <20070918090912.GA15007@localhost>
[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]
Johan Hedberg wrote:
> On Tue, Sep 18, 2007, Fabien Chevalier wrote:
>> As for the POLLOUT thing, i must say i'm confused..., and don't really
>> see the link with the patch :-(
>> I guess it works already as the GIOChannels heavily rely on it.
>
> GLib maps POLLOUT to G_IO_OUT, POLLHUP to G_IO_HUP, etc. I was saying
> that to conform to how other socket types behave[1] the callback should
> *not* be getting a HUP or ERR in this case but a OUT instead. As for
> applying the patch, I'm fine with it even though it in essence is a
> work-around for a kernel side problem. However, it's Marcel's call in
> the end.
>
> [1] I have yet to verify this but that's what the connect(2) manpage
> implies (in the section about EINPROGRESS)
Ok, thanks, this time i understood. :-)
I wrote a test program that does an asynchronous connect using the IP
stack. (I attached the file, you can dry run yourself if you're curious
;-) ). On error we receive a revent with POLLERR value, and no POLLOUT.
Conclusion is:
* POLLOUT is to be sent only when the channel is ready to send more data.
* POLLERR is the right thing to send when we cannot establish the
connection due to whatever error ==> The man page is a bit ambiguous
about it.
* which means the bt kernel part is fine and does not need fixing
* which means my patch is not a workaround but a clean fix to this
bogus error returning code :-)
Marcel, Johan, if you don't have any other remarks, you would mind
applying the patch ?
Cheers,
Fabien
[-- Attachment #2: main.c --]
[-- Type: text/x-csrc, Size: 882 bytes --]
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <poll.h>
#include <errno.h>
#include <assert.h>
#include <fcntl.h>
int main()
{
struct sockaddr_in addr;
int err;
struct pollfd pfds;
int sock = socket(AF_INET, SOCK_STREAM, 0);
addr.sin_family = AF_INET;
addr.sin_port = htons(81);
addr.sin_addr.s_addr = inet_addr("209.85.135.104");
fcntl(sock, F_SETFL, fcntl(sock, F_GETFL, 0) | O_NONBLOCK);
err = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
assert(err == -1 && errno == EINPROGRESS);
pfds.fd = sock;
pfds.events = POLLOUT;
err = poll(&pfds, 1, -1);
assert(err == 1);
printf("returned events from poll() routine:");
if(pfds.revents & POLLOUT)
printf("POLLOUT");
if(pfds.revents & POLLERR)
printf("POLLERR");
printf("\n");
}
[-- Attachment #3: fchevalier.vcf --]
[-- Type: text/x-vcard, Size: 242 bytes --]
begin:vcard
fn:Fabien CHEVALIER
n:CHEVALIER;Fabien
org:SILICOM
adr:;;4 rue de Jouanet; RENNES ATALANTE;;35700;FRANCE
email;internet:fchevalier@silicom.fr
title:Software & Studies Engineer
tel;work:+33 (0) 2 99 84 17 17
version:2.1
end:vcard
prev parent reply other threads:[~2007-09-18 12:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-17 17:41 [PATCH] Fix bogus avdtp error codes management Fabien Chevalier
2007-09-18 8:15 ` Johan Hedberg
2007-09-18 8:27 ` [Bluez-devel] " Marcel Holtmann
2007-09-18 8:57 ` Fabien Chevalier
2007-09-18 9:09 ` Johan Hedberg
2007-09-18 12:00 ` Fabien Chevalier [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=46EFBDC4.3040506@silicom.fr \
--to=fchevalier@silicom.fr \
--cc=bluez-devel@lists.sourceforge.net \
--cc=johan.hedberg@nokia.com \
--cc=marcel@holtmann.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