Re: Problems with too many connections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/9/27 Marcel Holtmann <marcel@xxxxxxxxxxxx>
>
> Hi Markus,
>
> > I want to write an application which repeats the following procedure
> > for several (100+) bluetooth (low energy) devices:
> >
> > 1. connect
> > 2. read register values
> > 3. disconnect
> >
> > Therefore I modified the source code from /attrib/interactive.c.  For
> > testing purposes I am only looping  over one device. See attached
> > source code.
> >
> > The code works fine. It connects, reads the values and disconnects.
> > However, after 1020 repetitions, the following error occurs:
> > (process:10205): GLib-WARNING **: poll(2) failed due to: Invalid argument.
> >
> > I think the problem has to do with some sockets / file descriptors not
> > being closed properly.
> >
> > Can someone help me to get this fixed?
>
> have you considered trying to write this from scratch and not basing this off existing code.
>
> And yes, this will be most likely an issues with GSource handling of the attribute IO channel, but since you hacked the code is extremely hard to debug. It was never designed for what you are doing.
>
> Regards
>
> Marcel
>

I found a solution myself.  I quote from:
https://github.com/webOS-ports/nyx-modules/commit/bbcbbd64000ba76f39215e43a5179408ff96e097

"When a watch is added to the
glib mainloop it references internally a file descriptor to pass it
later to the poll
function (see poll(2)). Every watch gets an id which should be used by
the user to refer
to the watch whenever needed. When the io channel is destroyed the
watch should be remove
from the mainloop as well. If this isn't done probably by the user it
will cause the
internal list of fds which are passed to the poll function to exceed
the maximum of 256.
This finally results in poll returning EINVAL as error code."

With the additions from there my code runs without problems.

Greetings
 Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux