This patch avoids sending the SCO fd when the connection is established
and the agent left the bus. This check covers the scenario when the
agent leaves the bus between "Connect" method call until the SCO
GIOChannel watch gets called.
---
 src/handsfree-audio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index 805f3b6..62d316f 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -251,7 +251,8 @@ static gboolean sco_connect_cb(GIOChannel *io, GIOCondition 
cond,
 
        sk = g_io_channel_unix_get_fd(io);
 
-       send_new_connection(card->path, sk);
+       if (agent)
+               send_new_connection(card->path, sk);
 
        close(sk);
 
-- 
1.7.11.7

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to