diff options
author | Santiago Carot-Nemesio <sancane@gmail.com> | 2010-10-13 18:37:40 +0200 |
---|---|---|
committer | Jose Antonio Santos Cadenas <santoscadenas@gmail.com> | 2010-10-14 12:50:54 +0200 |
commit | d44b6e979bd9e448a9a4ed5ffbcd0bd231f96197 (patch) | |
tree | 5c22ce440127baa72aa33882b0d51527e79b619d /health | |
parent | 70558ff3fb9af40527662483385714904c5a59a2 (diff) | |
download | bluez-d44b6e979bd9e448a9a4ed5ffbcd0bd231f96197.tar.gz |
Abort echo channel if connection was not successful
Diffstat (limited to 'health')
-rw-r--r-- | health/hdp.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/health/hdp.c b/health/hdp.c index 05b35d83..e885a57c 100644 --- a/health/hdp.c +++ b/health/hdp.c @@ -1303,6 +1303,24 @@ static void delete_echo_channel(struct hdp_channel *chan) /* TODO: Decide if more action is required here */ } +static void abort_echo_channel_cb(GError *err, gpointer data) +{ + struct hdp_channel *chan = data; + + if (err && err->code != MCAP_ERROR_INVALID_OPERATION) { + error("Aborting error: %s", err->message); + if (err->code == MCAP_INVALID_MDL) { + /* MDL is removed from MCAP so we can */ + /* free the data channel without sending */ + /* a MD_DELETE_MDL_REQ */ + health_channel_destroy(chan); + } + return; + } + + delete_echo_channel(chan); +} + static void destroy_create_dc_data(gpointer data) { struct hdp_create_dc *dc_data = data; @@ -1402,9 +1420,10 @@ static void hdp_echo_connect_cb(struct mcap_mdl *mdl, GError *err, "%s", err->message); g_dbus_send_message(hdp_conn->conn, reply); - /* Send abort request because remote side is */ - /* now in PENDING state (TODO: ...and delete it) */ - if (!mcap_mdl_abort(hdp_conn->hdp_chann->mdl, abort_mdl_cb, + /* Send abort request because remote */ + /* side is now in PENDING state. */ + if (!mcap_mdl_abort(hdp_conn->hdp_chann->mdl, + abort_echo_channel_cb, hdp_conn->hdp_chann, NULL, &gerr)) { error("%s", gerr->message); g_error_free(gerr); |