Closed Bug 1146822 Opened 5 years ago Closed 4 years ago

[Meta] Cleanup socket IPC code


(Firefox OS Graveyard :: General, defect)

Gonk (Firefox OS)
Not set


(Not tracked)



(Reporter: tzimmermann, Assigned: tzimmermann)



B2G's socket IPC code under ipc/ needs a cleanup.

 * Remove |UnixSocketConsumer|

|UnixSocketConsumer| has been replaced by |StreamSocket| and |ListenSocket|. The only user of |UnixSocketConsumer| is BlueZ's Bluetooth socket. We should either merge both classes or use |StreamSocket| as well.

 * New interface for |UnixSocketConnector|

|UnixSocketConnector| creates socket file descriptors for specific use cases. It currently wraps respective POSIX functions and allows to set socket flags. But its interface is inconsistent. The new interface shall allow to create stream sockets and listen sockets, and allow to accept stream sockets from listen sockets. Ideally, |UnixSocketConnector| stores all relevant parameters.

 * Generic receive handlers

|StreamSocket| forwards all received data to the main thread, but data can often be processed on the I/O thread or other helper threads. So this should be configurable. Users of stream sockets shall be able to set a consumer class for received data that implements the actual processing.

 * Implement |BluetoothDaemonConnection| on top of |StreamSocket|

Both classes do the same works, but the implementations differ in details. |BluetoothDaemonConnection| is Bluetooth-specific, while |StreamSocket| is for generic data. It should be possible to implement |BluetoothDaemonConnection| on top of |StreamSocket|.

 * Maybe remove some internal threads

NFC and RIL use helper threads for processing data. It might be possible to remove these helpers and run the code directly on the I/O thread. This would reduce overhead from cross-thread IPC.
I intend to work on this bug during Q2.
Depends on: 1154281
Depends on: 1156352
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #0)
> B2G's socket IPC code under ipc/ needs a cleanup.
>  * Remove |UnixSocketConsumer|

Has been resolved in bug 1154281.
Depends on: 1158818
Depends on: 1158876
Depends on: 1159209
Depends on: 1159709
Depends on: 1161020
Depends on: 1161003
Depends on: 1162524
Depends on: 1162585
Depends on: 1164417
Depends on: 1164425
Depends on: 1166638
>  * New interface for |UnixSocketConnector|

Landed in bug 1161020
Depends on: 1167207
Depends on: 1167210
Depends on: 1168446
Depends on: 1168806
>  * Generic receive handlers

Landed in bug 1166638 and bug 1167207. The multi-threading part of this task needs a different approach.
Depends on: 1170466
Depends on: 1170993
Depends on: 1171017
Depends on: 1171994
Depends on: 1172479
Depends on: 1173802
Depends on: 1173334
Depends on: 1185478
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.