summaryrefslogtreecommitdiff
path: root/audio/gateway.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-02-15 17:34:21 -0200
committerMarcel Holtmann <marcel@holtmann.org>2010-02-15 21:26:30 -0800
commit3eb33daebfa2934a9f447ed8e6653b088323f300 (patch)
tree177875443cf665e28e20eee74c8fabab244ab1e3 /audio/gateway.c
parent4e68b91447f6b681c73cdd385f4b989a5c431356 (diff)
audio/gateway.c: Don't reply to DBus when connection comes from AG
Diffstat (limited to 'audio/gateway.c')
-rw-r--r--audio/gateway.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/audio/gateway.c b/audio/gateway.c
index 46fbb636b..22e5da250 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -224,7 +224,7 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *err,
struct audio_device *dev = user_data;
struct gateway *gw = dev->gateway;
DBusMessage *reply;
- int sk;
+ int sk, ret;
if (err) {
error("connect(): %s", err->message);
@@ -242,11 +242,16 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *err,
gw->rfcomm = g_io_channel_ref(chan);
- if (!agent_sendfd(gw->agent, sk, newconnection_reply, dev))
+ ret = agent_sendfd(gw->agent, sk, newconnection_reply, dev);
+
+ if (!gw->msg)
+ return;
+
+ if (ret)
+ reply = dbus_message_new_method_return(gw->msg);
+ else
reply = g_dbus_create_error(gw->msg, ERROR_INTERFACE ".Failed",
"Can not pass file descriptor");
- else
- reply = dbus_message_new_method_return(gw->msg);
g_dbus_send_message(dev->conn, reply);
@@ -258,7 +263,6 @@ fail:
ERROR_INTERFACE ".Failed",
"Connection attempt failed");
-
change_state(dev, GATEWAY_STATE_DISCONNECTED);
}