<div dir="ltr">Hi Aleksander,<div>What do you think of the patch above? </div><div>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.</div>


<div>This can happen when,  say, the modem fails to respond in the given time.</div><div><br></div><div>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.</div>


<div><br></div><div>I have verified this works correctly with the altair plugin.<br><div><div><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 30, 2013 at 3:57 PM, Prathmesh Prabhu <span dir="ltr"><<a href="mailto:pprabhu@chromium.org" target="_blank">pprabhu@chromium.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Some MMBearer methods to disconnect the bearer assume that the bearer is<br>
disconnected even if the operation fails in a subclass. This leaves MMBearer<br>
and MMBroadbandBearer states out of sync.<br>
<br>
This patch notifies the bearer object of the final disconnection using<br>
mm_bearer_report_connection_status. This gives the subclasses a chance to update<br>
their state even when the disconnection attempt fails.<br>
---<br>
 src/mm-bearer.c | 14 ++++++++++++--<br>
 1 file changed, 12 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mm-bearer.c b/src/mm-bearer.c<br>
index f57ea8b..6592619 100644<br>
--- a/src/mm-bearer.c<br>
+++ b/src/mm-bearer.c<br>
@@ -441,7 +441,12 @@ disconnect_after_cancel_ready (MMBearer *self,<br>
     else<br>
         mm_dbg ("Disconnected bearer '%s'", self->priv->path);<br>
<br>
-    bearer_update_status (self, MM_BEARER_STATUS_DISCONNECTED);<br>
+    /* Report disconnection to the bearer object using class method<br>
+     * mm_bearer_report_connection_status. This gives subclass implementations a<br>
+     * chance to correctly update their own connection state, in case this base<br>
+     * class ignores a failed disconnection attempt.<br>
+     */<br>
+    mm_bearer_report_connection_status (self, MM_BEARER_CONNECTION_STATUS_DISCONNECTED);<br>
 }<br>
<br>
 static void<br>
@@ -945,7 +950,12 @@ disconnect_force_ready (MMBearer *self,<br>
     else<br>
         mm_dbg ("Disconnected bearer '%s'", self->priv->path);<br>
<br>
-    bearer_update_status (self, MM_BEARER_STATUS_DISCONNECTED);<br>
+    /* Report disconnection to the bearer object using class method<br>
+     * mm_bearer_report_connection_status. This gives subclass implementations a<br>
+     * chance to correctly update their own connection state, in case this base<br>
+     * class ignores a failed disconnection attempt.<br>
+     */<br>
+    mm_bearer_report_connection_status (self, MM_BEARER_CONNECTION_STATUS_DISCONNECTED);<br>
 }<br>
<br>
 void<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.4.1<br>
<br>
</font></span></blockquote></div><br></div>