diff options
author | Santiago Carot-Nemesio <sancane@gmail.com> | 2010-10-18 13:17:23 +0200 |
---|---|---|
committer | Jose Antonio Santos Cadenas <santoscadenas@gmail.com> | 2010-10-21 09:44:12 +0200 |
commit | f0e40f4c1db27d8a809dbe31749ced5b1eb1da01 (patch) | |
tree | 715c998f961f541e9bd8df2e9bb8b10bc8d3d48f /health | |
parent | 9c2b1e31ae1a420f17ca929b7e87412b929bcd00 (diff) | |
download | bluez-f0e40f4c1db27d8a809dbe31749ced5b1eb1da01.tar.gz |
Close the data channel if remote side changes the configuration
Diffstat (limited to 'health')
-rw-r--r-- | health/hdp.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/health/hdp.c b/health/hdp.c index 93728eead..8bb98df8a 100644 --- a/health/hdp.c +++ b/health/hdp.c @@ -629,17 +629,23 @@ static DBusMessage *channel_acquire(DBusConnection *conn, return reply; } -static DBusMessage *channel_release(DBusConnection *conn, - DBusMessage *msg, void *user_data) +static void close_mdl(struct hdp_channel *hdp_chann) { - struct hdp_channel *hdp_chann = user_data; int fd; fd = mcap_mdl_get_fd(hdp_chann->mdl); if (fd < 0) - return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); + return; close(fd); +} + +static DBusMessage *channel_release(DBusConnection *conn, + DBusMessage *msg, void *user_data) +{ + struct hdp_channel *hdp_chann = user_data; + + close_mdl(hdp_chann); return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } @@ -852,7 +858,7 @@ static gboolean check_channel_conf(struct hdp_channel *chan) switch (chan->config) { case HDP_RELIABLE_DC: return mode == L2CAP_MODE_ERTM; - case L2CAP_MODE_STREAMING: + case HDP_STREAMING_DC: return mode == L2CAP_MODE_STREAMING; default: error("Error: Connected with unknown configuration"); @@ -877,7 +883,7 @@ static void hdp_mcap_mdl_connected_cb(struct mcap_mdl *mdl, void *data) dev->channels = g_slist_prepend(dev->channels, chan); if (!check_channel_conf(chan)) { - /* TODO: Close MDL */ + close_mdl(chan); return; } |