2006-09-12 00:47:54

by Jose Vasconcellos

[permalink] [raw]
Subject: [Bluez-devel] socket connect returns EAGAIN

Hello,

I'm wondering why bluetooth sockets return EAGAIN on
connect quite frequently for both RFCOMM and SCO when
O_NONBLOCK is set. Is this the correct behavior?

-Jose


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2006-09-21 20:05:53

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN

Hi Ulisses,

> > what about the server socket. In this case EAGAIN is fine.
>
> Yes, in this case EAGAIN is fine. However, I don't think we are even
> calling bt_sock_wait_state() for a server socket (please, correct me
> if I'm wrong) so changing EAGAIN to EINPROGRESS inside
> bt_sock_wait_state() should just work, right? (we just need to fix
> rfcomm_session_create() too and that's it).

looks like it is okay, care to send a patch.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-21 19:59:40

by Ulisses Furquim

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN

On 9/20/06, Marcel Holtmann <[email protected]> wrote:
> what about the server socket. In this case EAGAIN is fine.

Yes, in this case EAGAIN is fine. However, I don't think we are even
calling bt_sock_wait_state() for a server socket (please, correct me
if I'm wrong) so changing EAGAIN to EINPROGRESS inside
bt_sock_wait_state() should just work, right? (we just need to fix
rfcomm_session_create() too and that's it).

Regards,

-- Ulisses

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-20 15:05:15

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN

Hi Ulisses,

> > > > > I think the problem is in bt_sock_wait_state(...). This always returns
> > > > > -EAGAIN if timeout is zero (which it is if the socket is set non
> > > > > blocking). But may be I'm missing something.
> > > >
> > > > I've come to a similar conclusion. I'm not sure why it's returning -EAGAIN.
> > > > However, looking at the x25 transport (af_x25.c), it takes a different
> > > > approach;
> > > > if O_NONBLOCK is set they don't call the blocking routine at all. Maybe a
> > > > similar approach should be taken here.
> > > >
> > > returning EAGAIN is fine for a listening socket. I first thought the
> > > solution of not calling bt_sock_wait_state() for a non blocking connect
> > > would be the easiest solution, too. But then you have to correct it on
> > > several places. Just changing bt_sock_wait_state() will solve it for
> > > various socket types.
> >
> > sounds like a good idea. Anyone preparing a patch for it?
>
> Sorry, but I'm failing to see why we can't just do a
> s/EAGAIN/EINPROGRESS/ inside bt_sock_wait_state(). Does anyone mind to
> explain, please?

what about the server socket. In this case EAGAIN is fine.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-20 15:00:01

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN


Hi Ulisses,

>
> Sorry, but I'm failing to see why we can't just do a
> s/EAGAIN/EINPROGRESS/ inside bt_sock_wait_state(). Does anyone mind to
> explain, please?

The only problem here is that somebody has to implement and test it ....

Ciao,
Peter


| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-20 14:48:49

by Ulisses Furquim

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN

On 9/15/06, Marcel Holtmann <[email protected]> wrote:
> > > > I think the problem is in bt_sock_wait_state(...). This always returns
> > > > -EAGAIN if timeout is zero (which it is if the socket is set non
> > > > blocking). But may be I'm missing something.
> > >
> > > I've come to a similar conclusion. I'm not sure why it's returning -EAGAIN.
> > > However, looking at the x25 transport (af_x25.c), it takes a different
> > > approach;
> > > if O_NONBLOCK is set they don't call the blocking routine at all. Maybe a
> > > similar approach should be taken here.
> > >
> > returning EAGAIN is fine for a listening socket. I first thought the
> > solution of not calling bt_sock_wait_state() for a non blocking connect
> > would be the easiest solution, too. But then you have to correct it on
> > several places. Just changing bt_sock_wait_state() will solve it for
> > various socket types.
>
> sounds like a good idea. Anyone preparing a patch for it?

Sorry, but I'm failing to see why we can't just do a
s/EAGAIN/EINPROGRESS/ inside bt_sock_wait_state(). Does anyone mind to
explain, please?

Regards,

-- Ulisses

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-15 09:49:51

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN

Hi Peter,

> > > I think the problem is in bt_sock_wait_state(...). This always returns
> > > -EAGAIN if timeout is zero (which it is if the socket is set non
> > > blocking). But may be I'm missing something.
> >
> > I've come to a similar conclusion. I'm not sure why it's returning -EAGAIN.
> > However, looking at the x25 transport (af_x25.c), it takes a different
> > approach;
> > if O_NONBLOCK is set they don't call the blocking routine at all. Maybe a
> > similar approach should be taken here.
> >
> returning EAGAIN is fine for a listening socket. I first thought the
> solution of not calling bt_sock_wait_state() for a non blocking connect
> would be the easiest solution, too. But then you have to correct it on
> several places. Just changing bt_sock_wait_state() will solve it for
> various socket types.

sounds like a good idea. Anyone preparing a patch for it?

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-14 09:01:08

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN



Hi Jose,

On Wed, 13 Sep 2006, Jose Vasconcellos wrote:

> > I think the problem is in bt_sock_wait_state(...). This always returns
> > -EAGAIN if timeout is zero (which it is if the socket is set non
> > blocking). But may be I'm missing something.
> >
> > Ciao,
> >
> > Peter
> >
> >
> Hi Peter,
>
> I've come to a similar conclusion. I'm not sure why it's returning -EAGAIN.
> However, looking at the x25 transport (af_x25.c), it takes a different
> approach;
> if O_NONBLOCK is set they don't call the blocking routine at all. Maybe a
> similar approach should be taken here.
>
returning EAGAIN is fine for a listening socket. I first thought the
solution of not calling bt_sock_wait_state() for a non blocking connect
would be the easiest solution, too. But then you have to correct it on
several places. Just changing bt_sock_wait_state() will solve it for
various socket types.

Ciao,

Peter



| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-13 14:21:54

by Jose Vasconcellos

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN

Peter Wippich wrote:
> Hi Marcel,
>
> On Tue, 12 Sep 2006, Marcel Holtmann wrote:
>
>
>> Hi Peter,
>>
>>
>>> see my last post on this subject about 4 days ago. From my understanding
>>> they shall return EINPROGRESS when the connection to the remote device is
>>> pending. Returning EAGAIN looks like a small bug. See also man 2 connect
>>> or man 7 socket.
>>>
>> this has been raised a long time ago. However the Bluetooth core inside
>> the kernel doesn't sets the wrong error. It is one of the network
>> functions we use.
>>
>
> Are you sure ?!?
>
> I think the problem is in bt_sock_wait_state(...). This always returns
> -EAGAIN if timeout is zero (which it is if the socket is set non
> blocking). But may be I'm missing something.
>
> Ciao,
>
> Peter
>
>
Hi Peter,

I've come to a similar conclusion. I'm not sure why it's returning -EAGAIN.
However, looking at the x25 transport (af_x25.c), it takes a different
approach;
if O_NONBLOCK is set they don't call the blocking routine at all. Maybe a
similar approach should be taken here.

Jose


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-12 10:29:51

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN

Hi Peter,

> > > see my last post on this subject about 4 days ago. From my understanding
> > > they shall return EINPROGRESS when the connection to the remote device is
> > > pending. Returning EAGAIN looks like a small bug. See also man 2 connect
> > > or man 7 socket.
> >
> > this has been raised a long time ago. However the Bluetooth core inside
> > the kernel doesn't sets the wrong error. It is one of the network
> > functions we use.
>
> Are you sure ?!?
>
> I think the problem is in bt_sock_wait_state(...). This always returns
> -EAGAIN if timeout is zero (which it is if the socket is set non
> blocking). But may be I'm missing something.

not 100% sure, but last time I tracked this down. Feel free to propose a
patch that changes the behavior and brings it in sync with the manual
page.

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-12 10:13:11

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN


Hi Marcel,

On Tue, 12 Sep 2006, Marcel Holtmann wrote:

> Hi Peter,
>
> > see my last post on this subject about 4 days ago. From my understanding
> > they shall return EINPROGRESS when the connection to the remote device is
> > pending. Returning EAGAIN looks like a small bug. See also man 2 connect
> > or man 7 socket.
>
> this has been raised a long time ago. However the Bluetooth core inside
> the kernel doesn't sets the wrong error. It is one of the network
> functions we use.

Are you sure ?!?

I think the problem is in bt_sock_wait_state(...). This always returns
-EAGAIN if timeout is zero (which it is if the socket is set non
blocking). But may be I'm missing something.

Ciao,

Peter


| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-12 08:43:33

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN

Hi Peter,

> see my last post on this subject about 4 days ago. From my understanding
> they shall return EINPROGRESS when the connection to the remote device is
> pending. Returning EAGAIN looks like a small bug. See also man 2 connect
> or man 7 socket.

this has been raised a long time ago. However the Bluetooth core inside
the kernel doesn't sets the wrong error. It is one of the network
functions we use.

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-09-12 08:40:56

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] socket connect returns EAGAIN


Hi Jose,

see my last post on this subject about 4 days ago. From my understanding
they shall return EINPROGRESS when the connection to the remote device is
pending. Returning EAGAIN looks like a small bug. See also man 2 connect
or man 7 socket.

Ciao,

Peter



On Mon, 11 Sep 2006, Jose Vasconcellos wrote:

> Hello,
>
> I'm wondering why bluetooth sockets return EAGAIN on
> connect quite frequently for both RFCOMM and SCO when
> O_NONBLOCK is set. Is this the correct behavior?
>
> -Jose
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel