service: Indicate IP Configuration Ready Event
authorGrant Erickson <marathon96@gmail.com>
Wed, 25 May 2011 17:10:17 +0000 (10:10 -0700)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 31 May 2011 19:30:04 +0000 (21:30 +0200)
commitb6480b70a2c9ededa0c49101d8a73f8bf45b3efa
tree03a01dbbf49fd848cc5e9544d45ae728981a03bf
parent8025a0a6c612c803eb676e143989575cd3045e03
service: Indicate IP Configuration Ready Event

In the Connection Manager, completion of a valid IP configuration
excites the service state machine to move from the "configuration" to
the "ready" state.

However, the existing implementation of IP configuration completion
explicitly attempts to directly manipulate service state, rather than
hinting at an excitation event.

As a consequence, a late IP configuration completion after the service
state machine has transitioned from "ready" to "online" can lead to an
incorrect transition back to the "ready" state. This causes the
connection count for the technology associated with that service to
increment again, unnecessarily.

This patch avoids this issue by providing a service object interface
that simply hints that an IP configuration is complete for a given IP
type, allowing the service object and its state machine to either hold
fast in the present state, returning an advisory error or advancing,
as before.

All prior invocations of __connman_service_indicate_state outside of
the service module for the CONNMAN_SERVICE_STATE_READY are replaced
with calls to this new interface.

Thanks to Daniel Wagner and Marcel Holtmann for offline IRC discussion
that helped motivate this fix.

  * v2: Incorporated feedback from Samuel Ortiz about combining IPv4
        and IPv6 states before checking state readiness.
src/connection.c
src/connman.h
src/network.c
src/service.c