UnixSocketConsumer now maintains a delay for re-establishing closed
connection. The initial delay is zero, so that the first connect call
is processed immediately. At the first failed attempt to connect, the
delay is set to ~1 second, and is increased by a factor of 2 on each
successive error until it reaches ~1 minute.
The UnixSocketConsumer code resets the delay to zero if it is lower
than the time that the connection was open. This heuristics protects
against cases where the peer establishes a connection, and closes it
shortly afterwards. Incompatible versions of rild show this behavior.
UnixSocketImpl, which mostly runs on the I/O thread, doesn't control
its reference to UnixSocketConsumer. If the connection status is
stored in UnixSocketConsumer, the I/O thread can't read it safely.
This patch duplicates the connection status in UnixSocketImpl, where
reading from the I/O thread is safe. Methods of UnixSocketImpl don't
need to access mConsumer any longer to obtain the connection status.
We used to allocate memory on the stack when reading from a file
descriptor and copied the result into an instance of UnixSocketRawData.
This patch
- cleans up the interface of UnixSocketRawData,
- removes the large stack allocation (64KiB), and
- removes the unnecessary memcpy.
Other memcpys for sending data have been moved into the constructor
of UnixSocketRawData.
--HG--
extra : rebase_source : 46ed1c73481732c3f3350bf0bedb56d376c24e98
r=tbsaunde for accessible
r=jmuizelaar for gfx
r=roc for layout
r=glandium for mozglue
r=jduell for netwerk
r=khuey for everything else
This is a mechanical change made with sed. Later patches in this queue
clean up the whitespace errors and so on.
This version of BlueZ from Code Aurora has added GOEP_PSM to Object
Push Profile service record, which means that remote devices may
connect with us via both L2CAP and RFCOMM. This patch completes
L2CAP/EL2CAP socket implementation.
After this new class is landed, communicating with other devices on
profile level should become more intuitive and reasonable. Each
Bluetooth*Manager doesn't need to inherit UnixSocketConsumer, instead,
BluetoothSocket inherits UnixSocketConsumer. That makes Bluetooth*Manager
be able to have more than 1 Bluetooth connections at a time with different
remote devices.