summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-10-25 23:19:58 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2008-10-25 23:19:58 +0300
commitf4779a985079cc7d85d5e0faac0e13497f3dd38c (patch)
tree9b2d57c543ce68ed945e13637b9c4920adaf7c0c
parente9fcc529a54338a8a1834f6bf92681eca1bd3e8e (diff)
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.
-rw-r--r--audio/avdtp.c10
1 files changed, 6 insertions, 4 deletions
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);