GIOStatus status;
gsize rbytes = 0;
+ if (!(con & G_IO_IN))
+ return FALSE;
+
spp_ctx = user_data;
if (spp_ctx == NULL) {
WARN("no spp find");
notify_connection_state(device_path, BT_SOCKET_DISCONNECTED, spp_ctx);
- g_io_channel_unref(spp_ctx->channel);
- spp_ctx->channel = NULL;
+ if (spp_ctx->channel) {
+ g_io_channel_shutdown(spp_ctx->channel, TRUE, NULL);
+ g_io_channel_unref(spp_ctx->channel);
+ spp_ctx->channel = NULL;
+ }
g_dbus_method_invocation_return_value(invocation, NULL);
}
DBG("");
- if (p1 == NULL) {
- ERROR("socket create must give the UUID");
- return 0;
- }
-
ret = bt_socket_destroy_rfcomm(socket_fd);
if (ret != BT_SUCCESS)
DBG("destroy socket failed");
"Usage: socket_create 00001101-0000-1000-8000-00805f9b34fb\n\tcreate socket with uuid"},
{"socket_destroy", socket_destroy,
- "Usage: socket_destroy\n\tdestory spp"},
+ "Usage: socket_destroy\n\tdestroy spp"},
{"socket_set_connection_state_changed_cb", socket_set_connection_state_changed_cb,
"Usage: socket_set_connection_state_changed_cb\n\tset connection state changed callback"},