struct pending_req *req;
guint dc_timer;
+ int dc_timeout;
/* Attempt stream setup instead of disconnecting */
gboolean stream_setup;
session);
}
#else
- if (!session->stream_setup && !session->streams)
+ DBG("timeout %d", session->dc_timeout);
+ if (!session->dc_timeout)
session->dc_timer = g_idle_add(disconnect_timeout, session);
else
- session->dc_timer = g_timeout_add_seconds(DISCONNECT_TIMEOUT,
+ session->dc_timer = g_timeout_add_seconds(session->dc_timeout,
disconnect_timeout,
session);
#endif
avdtp_sep_set_state(session, sep, AVDTP_STATE_CLOSING);
+ session->dc_timeout = DISCONNECT_TIMEOUT;
+
if (!avdtp_send(session, transaction, AVDTP_MSG_TYPE_ACCEPT,
AVDTP_CLOSE, NULL, 0))
return FALSE;
ret = avdtp_send(session, transaction, AVDTP_MSG_TYPE_ACCEPT,
AVDTP_ABORT, NULL, 0);
- if (ret)
+ if (ret) {
avdtp_sep_set_state(session, sep, AVDTP_STATE_ABORTING);
+ session->dc_timeout = DISCONNECT_TIMEOUT;
+ }
return ret;
}
* with respect to the disconnect timer */
session->stream_setup = TRUE;
+ session->dc_timeout = DISCONNECT_TIMEOUT;
+
avdtp_connect_cb(chan, NULL, session);
return session;
ret = send_request(session, FALSE, stream, AVDTP_CLOSE,
&req, sizeof(req));
- if (ret == 0)
+ if (ret == 0) {
stream->close_int = TRUE;
+ session->dc_timeout = 0;
+ }
return ret;
}
ret = send_request(session, TRUE, stream, AVDTP_ABORT,
&req, sizeof(req));
- if (ret == 0)
+ if (ret == 0) {
stream->abort_int = TRUE;
+ session->dc_timeout = 0;
+ }
return ret;
}