From: Stefan Mischke <survivor@uni-paderborn.de>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: BlueZ Mailing List <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] sdp_search and l2cap concurrently
Date: Sun, 12 Sep 2004 16:55:10 +0200 [thread overview]
Message-ID: <4144634E.4070404@uni-paderborn.de> (raw)
In-Reply-To: <1094997749.5695.13.camel@pegasus>
Hi Marcel!
Marcel Holtmann schrieb:
>what do you mean by cripple L2CAP and use it concurrently. Explain in
>more detail what your program is really doing
>
Ok, I'll explain it in Pseudo-Code:
DiscoveryThread does all the time {
InquiryInfo[] ii = do_inquiry();
DiscoveryInfo[] di = sdp_filter_for(my_l2cap_service, ii);
pass_to_UpdateThread(di):
}
UpdateThread does all the time {
check_for_new_DiscoveryInfo_and_add_them_to(internal_di, di);
do_for_all(di_item = internal_di[i]) {
int sock = l2cap_connect(di_item);
di_item.name = l2cap_read_descriptive_name(sock);
di_item.content = l2cap_read_website_content(sock);
di_item.rssi = hci_readRSSI(l2cap_sock2hci_conn(sock));
di_item.lq = hci_getLinkQuality(l2cap_sock2hci_conn(sock));
l2cap_close(sock);
di_item.sum = evaluate(di_item.rssi, di_item.lq);
}
sort_by_sum(di_internal);
show_nearest_website_content(di_internal[0]);
}
By "cripple" I mean if one device is almost out of range (l2cap
connections would fail, but inquiry discovered it anyway)
"sdp_filter_for(my_service, ii)" takes quite long to fail by timeout.
And in this time, the UpdateThread doesn't seem to run eigther. The
whole thing hangs. I think that is because all Java-Threads belong to
only one Linux-Process which communicates with BlueZ. And this process
is blocked by SDP for up to SDP_RESPONSE_TIMEOUT (see
bluez-sdp/libs/utils.c, sdp_read_rsp(..)). I tried to lower this timeout
by applying smaller timeouts SO_SNDTIMEO and SO_RCVTIMEO to the
sdp_session's l2cap socket, but this doesn't seem to work because of the
use of select().
In my opinion there are three ways to solve this:
1. Make SDP_RESPONSE_TIMEOUT a settable parameter
2. Don't use select(); instead put the socket to non-blocking state
("fcntl(sock, F_SETFL, flags | O_NONBLOCK)") while connecting.
3. Don't use select(); instead let the user/programmer chose to put a
SO_SNDTIMEO and SO_RCVTIMEO on the socket.
2. and 3. may be combined.
But probably, it is something quite different or there's an easy
solution. I just wanted to ask for it :-). I'll test further...
>and check how many low
>level HCI connections are opened at the same time.
>
>
I think there can only be one low level (ACL) connection to each device
at a time. Unfortunately, I have only 3 devices for testing. So this
can't be the problem.
Regards,
Stefan
next prev parent reply other threads:[~2004-09-12 14:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-11 14:14 [Bluez-devel] sdp_search and l2cap concurrently Stefan Mischke
2004-09-12 14:02 ` Marcel Holtmann
2004-09-12 14:55 ` Stefan Mischke [this message]
2004-09-14 14:15 ` Stefan Mischke
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=4144634E.4070404@uni-paderborn.de \
--to=survivor@uni-paderborn.de \
--cc=bluez-devel@lists.sourceforge.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.