From f4779a985079cc7d85d5e0faac0e13497f3dd38c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sat, 25 Oct 2008 23:19:58 +0300 Subject: Set stream timer in avdtp_sep_set_state instead of avdtp_suspend_resp This ensures that the timer is not only set when we requested the suspend but also when the other side requested the suspend. --- audio/avdtp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'audio/avdtp.c') diff --git a/audio/avdtp.c b/audio/avdtp.c index 93b40d9b..44d4c5ee 100644 --- a/audio/avdtp.c +++ b/audio/avdtp.c @@ -600,8 +600,9 @@ static void stream_free(struct avdtp_stream *stream) g_free(stream); } -static gboolean stream_timeout(struct avdtp_stream *stream) +static gboolean stream_timeout(gpointer user_data) { + struct avdtp_stream *stream = user_data; struct avdtp *session = stream->session; avdtp_close(session, stream); @@ -701,6 +702,10 @@ static void avdtp_sep_set_state(struct avdtp *session, switch (state) { case AVDTP_STATE_OPEN: + if (old_state > AVDTP_STATE_OPEN) + stream->idle_timer = g_timeout_add(STREAM_TIMEOUT, + stream_timeout, + stream); break; case AVDTP_STATE_STREAMING: case AVDTP_STATE_CLOSING: @@ -1957,9 +1962,6 @@ static gboolean avdtp_suspend_resp(struct avdtp *session, avdtp_sep_set_state(session, sep, AVDTP_STATE_OPEN); - stream->idle_timer = g_timeout_add(STREAM_TIMEOUT, - (GSourceFunc) stream_timeout, stream); - if (sep->cfm && sep->cfm->suspend) sep->cfm->suspend(session, sep, stream, NULL, sep->user_data); -- cgit