Remove disconnected event when we call disconnect API
authorDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 31 Aug 2012 00:44:42 +0000 (09:44 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 31 Aug 2012 00:46:12 +0000 (09:46 +0900)
[Issue] Requirement from OSP

Change-Id: Id8529f862793747e1563211bd20571491434eefc

debian/changelog
lib/bluetooth-rfcomm-api.c
packaging/bluetooth-frwk.spec

index 8bd8d377955d610083a9700657accbffcc54c12a..1fd9427868b9349385d9ddace123330745d88fbf 100644 (file)
@@ -1,3 +1,11 @@
+bluetooth-frwk (0.1.84) unstable; urgency=low
+
+  * Tagging and upload the package
+  * Git: slp/pkgs/b/bluetooth-frwk
+  * Tag: bluetooth-frwk_0.1.84
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Fri, 31 Aug 2012 09:39:10 +0900
+
 bluetooth-frwk (0.1.83) unstable; urgency=low
 
   * Tagging and upload the package
index b663d28947426adc6ac9da1ea71f6c74da7ecb1b..a9e471a708586f79c18d19fbadc2e75110256990 100644 (file)
@@ -1561,6 +1561,39 @@ BT_EXPORT_API int bluetooth_rfcomm_server_disconnect(int socket_fd)
 
 }
 
+static int __rfcomm_server_disconnect(int socket_fd)
+{
+       DBG("+\n");
+
+       static char *default_adapter_obj_path = NULL;
+       bt_info_t *bt_internal_info = NULL;
+       int index = 0;
+
+       if (socket_fd <= 0)
+               return BLUETOOTH_ERROR_INVALID_PARAM;
+
+       if (__get_default_adapter_path(&default_adapter_obj_path) < 0) {
+               DBG("Fail to get default hci adapter path\n");
+               return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+       }
+
+       bt_internal_info = _bluetooth_internal_get_information();
+
+       index = __bluetooth_rfcomm_internal_server_get_index_from_client_socket(socket_fd);
+       if (index < 0) {
+               DBG("Invalid index %d  for socket %d\n", index, socket_fd);
+               return BLUETOOTH_ERROR_INVALID_PARAM;
+       }
+
+       g_source_remove(rfcomm_server[index].client_event_src_id);
+       close(rfcomm_server[index].client_sock_fd);
+       rfcomm_server[index].client_sock_fd = -1;
+
+       DBG("-\n");
+
+       return BLUETOOTH_ERROR_NONE;
+
+}
 
 /* Asynchrous implementation */
 static void __rfcomm_client_connected_cb(DBusGProxy *proxy, DBusGProxyCall *call,
@@ -2016,7 +2049,7 @@ BT_EXPORT_API int bluetooth_rfcomm_disconnect(int socket_fd)
                DBG("Invalid index %d  for socket %d\n", index, socket_fd);
 
                /* Try to disconnect server socket */
-               return bluetooth_rfcomm_server_disconnect(socket_fd);
+               return __rfcomm_server_disconnect(socket_fd);
        }
 
        if (!(socket_fd && (socket_fd == rfcomm_client[index].sock_fd)) ||
@@ -2027,12 +2060,23 @@ BT_EXPORT_API int bluetooth_rfcomm_disconnect(int socket_fd)
 
        ret = __bluetooth_rfcomm_internal_disconnect(index);
 
-       if (ret == BLUETOOTH_ERROR_NONE)
-               __rfcomm_internal_terminate_client(index);
+       if (ret != BLUETOOTH_ERROR_NONE)
+               return ret;
+
+       g_source_remove(rfcomm_client[index].event_src_id);
+       rfcomm_client[index].event_src_id = -1;
+
+       close(rfcomm_client[index].sock_fd);
+       rfcomm_client[index].sock_fd = -1;
+       if (rfcomm_client[index].dev_node_name != NULL)
+               g_free(rfcomm_client[index].dev_node_name);
+       rfcomm_client[index].dev_node_name = NULL;
+
+       rfcomm_client[index].id = -1;
 
        DBG("-\n");
 
-       return ret;
+       return BLUETOOTH_ERROR_NONE;
 
 }
 
index 78ed289036add02b6b8af19723f059e188a93a9f..0ffa3460eae07387016968d1c24d1fc453b0b8e2 100644 (file)
@@ -1,6 +1,6 @@
 Name:       bluetooth-frwk
 Summary:    Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
-Version:    0.1.83
+Version:    0.1.84
 Release:    1
 Group:      TO_BE/FILLED_IN
 License:    TO BE FILLED IN