Add the socket server remote_address 60/27160/1
authorwu zheng <wu.zheng@intel.com>
Fri, 5 Sep 2014 09:58:25 +0000 (17:58 +0800)
committerwu zheng <wu.zheng@intel.com>
Fri, 5 Sep 2014 09:58:25 +0000 (17:58 +0800)
remote_address is not saved.
The current patch fix it.

Change-Id: I11a08bab25f2d4c2d5ad4db8df7bfb5fb69f2b8a
Signed-off-by: Wu Zheng <wu.zheng@intel.com>
capi/bluetooth.c

index 295c6e8..8a260b4 100644 (file)
@@ -3432,6 +3432,8 @@ static void handle_spp_authorize_request(bluez_device_t *device,
 
        spp_ctx->requestion = invocation;
        spp_ctx->role = BT_SOCKET_SERVER;
+       if (spp_ctx->remote_address)
+               g_free(spp_ctx->remote_address);
        spp_ctx->remote_address = g_strdup(device_address);
 
        if (socket_connection_requested_node)
@@ -3947,6 +3949,9 @@ static void notify_connection_state(gchar *device_path,
        device_name = bluez_device_get_property_alias(device);
        address = bluez_device_get_property_address(device);
 
+       if (spp_ctx->remote_address == NULL)
+               spp_ctx->remote_address = g_strdup(address);
+
        fd = g_io_channel_unix_get_fd(spp_ctx->channel);
 
        if (spp_ctx->new_connection && state == BT_SOCKET_CONNECTED)