[PATCH] bearer: notify final disconnect status using mm_bearer_report_connection_status

Aleksander Morgado aleksander at lanedo.com
Thu Nov 7 23:46:50 PST 2013


On 08/11/13 00:29, Prathmesh Prabhu Chromium wrote:
> Hi Aleksander,
> What do you think of the patch above? 
> Whenever there is a failed disconnect_force / disconnect_after_cancel
> (when a connect attempt is cancelled) attempt at the plugin level, the
> mm-core is left in a weird state because the mm-bearer assumes the
> disconnect succeeded anyway, while mm-broadband-bearer does not cleanup
> after itself.
> This can happen when,  say, the modem fails to respond in the given time.
> 
> By using class method mm_bearer_report_connection_status in mm-bearer,
> the bearer hierarchy gets a chance to clean up. This function is already
> used by the plugin to notify the whole hierarchy of a connection drop.
> 
> I have verified this works correctly with the altair plugin.
> 
> 

Makes total sense, yes. Pushed to git master now.

Thanks!

> 
> On Wed, Oct 30, 2013 at 3:57 PM, Prathmesh Prabhu <pprabhu at chromium.org
> <mailto:pprabhu at chromium.org>> wrote:
> 
>     Some MMBearer methods to disconnect the bearer assume that the bearer is
>     disconnected even if the operation fails in a subclass. This leaves
>     MMBearer
>     and MMBroadbandBearer states out of sync.
> 
>     This patch notifies the bearer object of the final disconnection using
>     mm_bearer_report_connection_status. This gives the subclasses a
>     chance to update
>     their state even when the disconnection attempt fails.
>     ---
>      src/mm-bearer.c | 14 ++++++++++++--
>      1 file changed, 12 insertions(+), 2 deletions(-)
> 
>     diff --git a/src/mm-bearer.c b/src/mm-bearer.c
>     index f57ea8b..6592619 100644
>     --- a/src/mm-bearer.c
>     +++ b/src/mm-bearer.c
>     @@ -441,7 +441,12 @@ disconnect_after_cancel_ready (MMBearer *self,
>          else
>              mm_dbg ("Disconnected bearer '%s'", self->priv->path);
> 
>     -    bearer_update_status (self, MM_BEARER_STATUS_DISCONNECTED);
>     +    /* Report disconnection to the bearer object using class method
>     +     * mm_bearer_report_connection_status. This gives subclass
>     implementations a
>     +     * chance to correctly update their own connection state, in
>     case this base
>     +     * class ignores a failed disconnection attempt.
>     +     */
>     +    mm_bearer_report_connection_status (self,
>     MM_BEARER_CONNECTION_STATUS_DISCONNECTED);
>      }
> 
>      static void
>     @@ -945,7 +950,12 @@ disconnect_force_ready (MMBearer *self,
>          else
>              mm_dbg ("Disconnected bearer '%s'", self->priv->path);
> 
>     -    bearer_update_status (self, MM_BEARER_STATUS_DISCONNECTED);
>     +    /* Report disconnection to the bearer object using class method
>     +     * mm_bearer_report_connection_status. This gives subclass
>     implementations a
>     +     * chance to correctly update their own connection state, in
>     case this base
>     +     * class ignores a failed disconnection attempt.
>     +     */
>     +    mm_bearer_report_connection_status (self,
>     MM_BEARER_CONNECTION_STATUS_DISCONNECTED);
>      }
> 
>      void
>     --
>     1.8.4.1
> 
> 
> 
> 
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
> 


-- 
Aleksander


More information about the ModemManager-devel mailing list