libqmi-glib,proxy: implicitly track QMI clients
When a client application closes the communication socket without having released explicitly the QMI clients it allocated, we're now keeping track of them (disowned QMI clients) and we'll recover them if another client application arrives using them without explicitly allocating them (e.g. the case of qmicli using --client-cid=[CID] and --client-no-release-cid).
The fact that we keep track of the disowned clients is really not important, we only really used that for a better proxy logging. The key change is to implicitly track the QMI clients if the client application starts to use a QMI client without allocating it first.
The QMI client untrack logic is also changed so that we don't wait for the "CTL Release ID" command to consider the client released by the proxy for tracking purposes. This helps the disowned client logic management because an application may run a bunch of "CTL Release ID" commands one after the other before exiting, and so without even waiting for the responses.
Fixes #38 (closed)
aleksander@ares:~$ sudo qmicli -d /dev/cdc-wdm3 -p --loc-start --client-no-release-cid
[/dev/cdc-wdm3] Successfully started location tracking (session id 0)
[/dev/cdc-wdm3] Client ID not released:
Service: 'loc'
CID: '1'
aleksander@ares:~$ sudo qmicli -d /dev/cdc-wdm3 -p --client-no-release-cid --client-cid=1 --loc-follow-nmea
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGGA,,,,,,0,,,,,,,,*66
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGGA,,,,,,0,,,,,,,,*66
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGGA,,,,,,0,,,,,,,,*66
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGGA,,,,,,0,,,,,,,,*66
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGGA,,,,,,0,,,,,,,,*66
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGGA,,,,,,0,,,,,,,,*66
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGGA,,,,,,0,,,,,,,,*66
^C
cancelling the operation...
[/dev/cdc-wdm3] Client ID not released:
Service: 'loc'
CID: '1'
aleksander@ares:~$ sudo qmicli -d /dev/cdc-wdm3 -p --loc-stop --client-cid=1
[/dev/cdc-wdm3] Successfully stopped location tracking (session id 0)