summaryrefslogtreecommitdiffstats
path: root/stack/rfcomm/port_api.c
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2013-01-15 15:54:03 -0800
committerMatthew Xie <mattx@google.com>2013-01-15 20:53:23 -0800
commit9ac641d0a674333af57b85b367e64cf94dfae291 (patch)
tree0786d77610c9e35abdfa74a00d01b2ff8cb9c10a /stack/rfcomm/port_api.c
parent689d66b6559dcb3a0ad7f6cc33b6129e50910253 (diff)
downloadandroid_system_bt-9ac641d0a674333af57b85b367e64cf94dfae291.tar.gz
android_system_bt-9ac641d0a674333af57b85b367e64cf94dfae291.tar.bz2
android_system_bt-9ac641d0a674333af57b85b367e64cf94dfae291.zip
fixed rfc resouce leaking and multi-session issue
also added more debug messages bug 7486080 Change-Id: Ic21e9d2df5f651b51ea2126a3cac25811808dcfb
Diffstat (limited to 'stack/rfcomm/port_api.c')
-rw-r--r--stack/rfcomm/port_api.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/stack/rfcomm/port_api.c b/stack/rfcomm/port_api.c
index 617d31be0..325d8fa07 100644
--- a/stack/rfcomm/port_api.c
+++ b/stack/rfcomm/port_api.c
@@ -84,8 +84,6 @@ int RFCOMM_CreateConnection (UINT16 uuid, UINT8 scn, BOOLEAN is_server,
tRFC_MCB *p_mcb = port_find_mcb (bd_addr);
UINT16 rfcomm_mtu;
- RFCOMM_TRACE_API3 ("RFCOMM_CreateConnection() called SCN: %d is_server:%d mtu:%d",
- scn, is_server, mtu);
RFCOMM_TRACE_API6 ("RFCOMM_CreateConnection() BDA: %02x-%02x-%02x-%02x-%02x-%02x",
bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5]);
@@ -104,6 +102,8 @@ int RFCOMM_CreateConnection (UINT16 uuid, UINT8 scn, BOOLEAN is_server,
dlci = (scn << 1) + 1;
else
dlci = (scn << 1);
+ RFCOMM_TRACE_API5("RFCOMM_CreateConnection(): scn:%d, dlci:%d, is_server:%d mtu:%d, p_mcb:%p",
+ scn, dlci, is_server, mtu, p_mcb);
/* For the server side always allocate a new port. On the client side */
/* do not allow the same (dlci, bd_addr) to be opened twice by application */
@@ -123,6 +123,8 @@ int RFCOMM_CreateConnection (UINT16 uuid, UINT8 scn, BOOLEAN is_server,
RFCOMM_TRACE_WARNING0 ("RFCOMM_CreateConnection - no resources");
return (PORT_NO_RESOURCES);
}
+ RFCOMM_TRACE_API6("RFCOMM_CreateConnection(): scn:%d, dlci:%d, is_server:%d mtu:%d, p_mcb:%p, p_port:%p",
+ scn, dlci, is_server, mtu, p_mcb, p_port);
p_port->default_signal_state = (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON);
@@ -309,7 +311,30 @@ int PORT_SetEventCallback (UINT16 port_handle, tPORT_CALLBACK *p_port_cb)
return (PORT_SUCCESS);
}
+/*******************************************************************************
+**
+** Function PORT_ClearKeepHandleFlag
+**
+** Description This function is called to clear the keep handle flag
+** which will cause not to keep the port handle open when closed
+** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
+**
+*******************************************************************************/
+
+int PORT_ClearKeepHandleFlag (UINT16 port_handle)
+{
+ tPORT *p_port;
+ /* Check if handle is valid to avoid crashing */
+ if ((port_handle == 0) || (port_handle > MAX_RFC_PORTS))
+ {
+ return (PORT_BAD_HANDLE);
+ }
+
+ p_port = &rfc_cb.port.port[port_handle - 1];
+ p_port->keep_port_handle = 0;
+ return (PORT_SUCCESS);
+}
/*******************************************************************************
**