2011-01-05 11:48:34

by Ilya Basin

[permalink] [raw]
Subject: listening socket not notified when bluetoothd stops, but becomes unusable

I use nonblocking sockets and select(). When I restart bluetoothd,
select() doen't return, but the listening socket won't accept
connections anymore. How to handle this correctly?



2011-01-05 13:34:35

by Ilya Basin

[permalink] [raw]
Subject: Re[2]: listening socket not notified when bluetoothd stops, but becomes unusable

Hi.
LAvD> If you are using BDADDR_ANY than that is probably ok, now for specific
LAvD> adapter this could be a bug
I just copied the code from someone else's project:
sdpSession = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);

I understand now, why select() doesn't return, but I still can't
connect.

LAvD> adapter is powered off after bluetoothd restart than you won't be able
LAvD> to accept connections.
If I restart my program after restarting bluetoothd, it accepts
connections.



2011-01-05 12:56:03

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: listening socket not notified when bluetoothd stops, but becomes unusable

Hi,

On Wed, Jan 5, 2011 at 1:48 PM, Ilya Basin <[email protected]> wrote:
> I use nonblocking sockets and select(). When I restart bluetoothd,
> select() doen't return, but the listening socket won't accept
> connections anymore. How to handle this correctly?

If you are using BDADDR_ANY than that is probably ok, now for specific
adapter this could be a bug but Im not sure about the powered state
before you restart and if RememberPowered is set, it could be that the
adapter is powered off after bluetoothd restart than you won't be able
to accept connections.

--
Luiz Augusto von Dentz
Computer Engineer