[PATCH] device: Disconnect service when disabling device

Jukka Rissanen jukka.rissanen at linux.intel.com
Thu Jan 5 02:45:11 PST 2012


On 01/05/2012 12:06 PM, Daniel Wagner wrote:
> Hi Jukka,
>
> On Thu, Dec 29, 2011 at 02:50:21PM +0200, Jukka Rissanen wrote:
>> We should disconnect service instead of disconnecting network
>> when device is disabled. Otherwise service might still have
>> a pointer to network that is no longer valid.
>>
>> Fixes BMC#24592
>> ---
>>   src/device.c |   11 +++++++++--
>>   1 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/device.c b/src/device.c
>> index 6a34d40..d150849 100644
>> --- a/src/device.c
>> +++ b/src/device.c
>> @@ -306,8 +306,15 @@ int __connman_device_disable(struct connman_device *device)
>>
>>   	clear_scan_trigger(device);
>>
>> -	if (device->network)
>> -		connman_network_set_connected(device->network, FALSE);
>> +	if (device->network) {
>> +		struct connman_service *svc;
>> +
>> +		svc = __connman_service_lookup_from_network(device->network);
>> +		if (svc != NULL)
>> +			__connman_service_disconnect(svc);
>> +		else
>> +			connman_network_set_connected(device->network, FALSE);
>> +	}
>
> Only nitpicking. I would prefer to use the variable name "service" instead of
> "srv". This would be more consistent with the rest of the coe.

Yeah, originally I had that but this version looked nicer as it would 
fit into 80 char line limit ;)
Anyway, I can send the original version.

>
> thanks,
> daniel
>

Cheers,
Jukka



More information about the connman mailing list