OSDN Git Service
(root)
/
android-x86
/
system-bt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allocate/free the SDP connection timers only during stack startup/shutdown
[android-x86/system-bt.git]
/
stack
/
sdp
/
sdp_main.c
diff --git
a/stack/sdp/sdp_main.c
b/stack/sdp/sdp_main.c
index
19f48b5
..
8c6c612
100644
(file)
--- a/
stack/sdp/sdp_main.c
+++ b/
stack/sdp/sdp_main.c
@@
-43,6
+43,8
@@
#include "sdpint.h"
#include "sdpint.h"
+extern fixed_queue_t *btu_general_alarm_queue;
+
/********************************************************************************/
/* G L O B A L S D P D A T A */
/********************************************************************************/
/********************************************************************************/
/* G L O B A L S D P D A T A */
/********************************************************************************/
@@
-83,6
+85,10
@@
void sdp_init (void)
/* Clears all structures and local SDP database (if Server is enabled) */
memset (&sdp_cb, 0, sizeof (tSDP_CB));
/* Clears all structures and local SDP database (if Server is enabled) */
memset (&sdp_cb, 0, sizeof (tSDP_CB));
+ for (int i = 0; i < SDP_MAX_CONNECTIONS; i++) {
+ sdp_cb.ccb[i].sdp_conn_timer = alarm_new("sdp.sdp_conn_timer");
+ }
+
/* Initialize the L2CAP configuration. We only care about MTU and flush */
sdp_cb.l2cap_my_cfg.mtu_present = TRUE;
sdp_cb.l2cap_my_cfg.mtu = SDP_MTU_SIZE;
/* Initialize the L2CAP configuration. We only care about MTU and flush */
sdp_cb.l2cap_my_cfg.mtu_present = TRUE;
sdp_cb.l2cap_my_cfg.mtu = SDP_MTU_SIZE;
@@
-137,6
+143,13
@@
void sdp_init (void)
}
}
}
}
+void sdp_free(void) {
+ for (int i = 0; i < SDP_MAX_CONNECTIONS; i++) {
+ alarm_free(sdp_cb.ccb[i].sdp_conn_timer);
+ sdp_cb.ccb[i].sdp_conn_timer = NULL;
+ }
+}
+
#if (defined(SDP_DEBUG) && SDP_DEBUG == TRUE)
/*******************************************************************************
**
#if (defined(SDP_DEBUG) && SDP_DEBUG == TRUE)
/*******************************************************************************
**
@@
-379,16
+392,17
@@
static void sdp_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
{
p_ccb->con_state = SDP_STATE_CONNECTED;
{
p_ccb->con_state = SDP_STATE_CONNECTED;
- if (p_ccb->con_flags & SDP_FLAGS_IS_ORIG)
+ if (p_ccb->con_flags & SDP_FLAGS_IS_ORIG)
{
sdp_disc_connected (p_ccb);
sdp_disc_connected (p_ccb);
- else
+ } else {
/* Start inactivity timer */
/* Start inactivity timer */
- btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_SDP, SDP_INACT_TIMEOUT);
+ alarm_set_on_queue(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS,
+ sdp_conn_timer_timeout, p_ccb,
+ btu_general_alarm_queue);
+ }
}
}
-
}
}
-
/*******************************************************************************
**
** Function sdp_config_cfm
/*******************************************************************************
**
** Function sdp_config_cfm
@@
-421,11
+435,14
@@
static void sdp_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg)
{
p_ccb->con_state = SDP_STATE_CONNECTED;
{
p_ccb->con_state = SDP_STATE_CONNECTED;
- if (p_ccb->con_flags & SDP_FLAGS_IS_ORIG)
+ if (p_ccb->con_flags & SDP_FLAGS_IS_ORIG)
{
sdp_disc_connected (p_ccb);
sdp_disc_connected (p_ccb);
- else
+ } else {
/* Start inactivity timer */
/* Start inactivity timer */
- btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_SDP, SDP_INACT_TIMEOUT);
+ alarm_set_on_queue(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS,
+ sdp_conn_timer_timeout, p_ccb,
+ btu_general_alarm_queue);
+ }
}
}
else
}
}
else
@@
-525,7
+542,7
@@
static void sdp_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg)
SDP_TRACE_WARNING ("SDP - Rcvd L2CAP data, unknown CID: 0x%x", l2cap_cid);
}
SDP_TRACE_WARNING ("SDP - Rcvd L2CAP data, unknown CID: 0x%x", l2cap_cid);
}
- osi_free
buf
(p_msg);
+ osi_free(p_msg);
}
}
@@
-692,7
+709,7
@@
static void sdp_disconnect_cfm (UINT16 l2cap_cid, UINT16 result)
/*******************************************************************************
**
/*******************************************************************************
**
-** Function sdp_conn_timeout
+** Function sdp_conn_time
r_time
out
**
** Description This function processes a timeout. Currently, we simply send
** a disconnect request to L2CAP.
**
** Description This function processes a timeout. Currently, we simply send
** a disconnect request to L2CAP.
@@
-700,8
+717,10
@@
static void sdp_disconnect_cfm (UINT16 l2cap_cid, UINT16 result)
** Returns void
**
*******************************************************************************/
** Returns void
**
*******************************************************************************/
-void sdp_conn_time
out (tCONN_CB*p_ccb
)
+void sdp_conn_time
r_timeout(void *data
)
{
{
+ tCONN_CB *p_ccb = (tCONN_CB *)data;
+
SDP_TRACE_EVENT ("SDP - CCB timeout in state: %d CID: 0x%x",
p_ccb->con_state, p_ccb->connection_id);
SDP_TRACE_EVENT ("SDP - CCB timeout in state: %d CID: 0x%x",
p_ccb->con_state, p_ccb->connection_id);