diff options
author | Greg Suarez <gpsuarez2512@gmail.com> | 2014-10-23 13:15:17 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-10-29 22:21:18 +0100 |
commit | 3a76c0df5790dc4cd2019bd67b1e36c7f4114b32 (patch) | |
tree | b95f19046b10274a63f429929057d76ea8cad25c /src/mm-bearer-mbim.c | |
parent | 046d9141c4277ac4b66c227a6e4649b1276f6a71 (diff) |
bearer-mbim: Implement report_connection_status() to set the port as disconnected
When the MBIM modem unexpectedly loses connection the port state never
gets set as disconnected thus when trying to reestablish a new
connection the bearer cannot find a port in the disconnected state.
Signed-off-by: Greg Suarez <gpsuarez2512@gmail.com>
Diffstat (limited to 'src/mm-bearer-mbim.c')
-rw-r--r-- | src/mm-bearer-mbim.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c index 358b261a..c554c527 100644 --- a/src/mm-bearer-mbim.c +++ b/src/mm-bearer-mbim.c @@ -950,6 +950,15 @@ disconnect_finish (MMBaseBearer *self, return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error); } +static void +reset_bearer_connection (MMBearerMbim *self) +{ + if (self->priv->data) { + mm_port_set_connected (self->priv->data, FALSE); + g_clear_object (&self->priv->data); + } +} + static void disconnect_context_step (DisconnectContext *ctx); static void @@ -1064,8 +1073,7 @@ disconnect_context_step (DisconnectContext *ctx) case DISCONNECT_STEP_LAST: /* Port is disconnected; update the state */ - mm_port_set_connected (ctx->self->priv->data, FALSE); - g_clear_object (&ctx->self->priv->data); + reset_bearer_connection (ctx->self); g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); disconnect_context_complete_and_free (ctx); @@ -1126,6 +1134,20 @@ mm_bearer_mbim_get_session_id (MMBearerMbim *self) /*****************************************************************************/ +static void +report_connection_status (MMBaseBearer *self, + MMBearerConnectionStatus status) +{ + if (status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED) + /* Cleanup all connection related data */ + reset_bearer_connection (MM_BEARER_MBIM (self)); + + /* Chain up parent's report_connection_status() */ + MM_BASE_BEARER_CLASS (mm_bearer_mbim_parent_class)->report_connection_status (self, status); +} + +/*****************************************************************************/ + MMBaseBearer * mm_bearer_mbim_new (MMBroadbandModemMbim *modem, MMBearerProperties *config, @@ -1221,6 +1243,7 @@ mm_bearer_mbim_class_init (MMBearerMbimClass *klass) base_bearer_class->connect_finish = connect_finish; base_bearer_class->disconnect = disconnect; base_bearer_class->disconnect_finish = disconnect_finish; + base_bearer_class->report_connection_status = report_connection_status; properties[PROP_SESSION_ID] = g_param_spec_uint (MM_BEARER_MBIM_SESSION_ID, |