summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/avdtp.c6
-rw-r--r--audio/control.c10
-rw-r--r--audio/gstavdtpsink.c3
-rw-r--r--audio/headset.c10
-rw-r--r--audio/main.c4
-rw-r--r--audio/manager.c6
-rw-r--r--common/glib-helper.c2
-rw-r--r--input/device.c12
-rw-r--r--input/server.c8
-rw-r--r--network/connection.c6
-rw-r--r--network/server.c2
-rw-r--r--serial/port.c4
-rw-r--r--serial/proxy.c2
-rw-r--r--src/device.c8
-rw-r--r--test/btiotest.c8
15 files changed, 45 insertions, 46 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index bc021d6c..5c21b95e 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -1832,7 +1832,7 @@ static void avdtp_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
if (!g_slist_find(sessions, session)) {
debug("avdtp_connect_cb: session got removed");
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
return;
}
@@ -1996,7 +1996,7 @@ static void avdtp_confirm_cb(GIOChannel *chan, gpointer data)
return;
drop:
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
}
static int l2cap_connect(struct avdtp *session)
@@ -3181,7 +3181,7 @@ void avdtp_exit(const bdaddr_t *src)
servers = g_slist_remove(servers, server);
- g_io_channel_close(server->io);
+ g_io_channel_shutdown(server->io, TRUE, NULL);
g_io_channel_unref(server->io);
g_free(server);
}
diff --git a/audio/control.c b/audio/control.c
index 0986c015..efe9f987 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -679,7 +679,7 @@ static void avctp_server_cb(GIOChannel *chan, GError *err, gpointer data)
if (gerr) {
error("%s", gerr->message);
g_error_free(gerr);
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
return;
}
@@ -731,7 +731,7 @@ proceed:
return;
drop:
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
avctp_unref(session);
}
@@ -766,7 +766,7 @@ static void avctp_connect_cb(GIOChannel *chan, GError *err, gpointer data)
if (!session) {
debug("avctp_connect_cb: session removed while connecting");
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
g_io_channel_unref(chan);
return;
}
@@ -785,7 +785,7 @@ static void avctp_connect_cb(GIOChannel *chan, GError *err, gpointer data)
avctp_unref(session);
error("%s", gerr->message);
g_error_free(gerr);
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
return;
}
@@ -952,7 +952,7 @@ void avrcp_unregister(const bdaddr_t *src)
remove_record_from_server(server->ct_record_id);
remove_record_from_server(server->tg_record_id);
- g_io_channel_close(server->io);
+ g_io_channel_shutdown(server->io, TRUE, NULL);
g_io_channel_unref(server->io);
g_free(server);
diff --git a/audio/gstavdtpsink.c b/audio/gstavdtpsink.c
index a5ac3bdd..586dfe14 100644
--- a/audio/gstavdtpsink.c
+++ b/audio/gstavdtpsink.c
@@ -144,8 +144,7 @@ static gboolean gst_avdtp_sink_stop(GstBaseSink *basesink)
}
if (self->stream) {
- g_io_channel_flush(self->stream, NULL);
- g_io_channel_close(self->stream);
+ g_io_channel_shutdown(self->stream, TRUE, NULL);
g_io_channel_unref(self->stream);
self->stream = NULL;
}
diff --git a/audio/headset.c b/audio/headset.c
index e923fd68..7ed1bb07 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -413,7 +413,7 @@ static void pending_connect_finalize(struct audio_device *dev)
g_slist_free(p->callbacks);
if (p->io) {
- g_io_channel_close(p->io);
+ g_io_channel_shutdown(p->io, TRUE, NULL);
g_io_channel_unref(p->io);
}
@@ -1130,7 +1130,7 @@ static void close_sco(struct audio_device *device)
if (hs->sco) {
g_source_remove(hs->sco_id);
hs->sco_id = 0;
- g_io_channel_close(hs->sco);
+ g_io_channel_shutdown(hs->sco, TRUE, NULL);
g_io_channel_unref(hs->sco);
hs->sco = NULL;
}
@@ -2024,12 +2024,12 @@ static void headset_free(struct audio_device *dev)
}
if (hs->sco) {
- g_io_channel_close(hs->sco);
+ g_io_channel_shutdown(hs->sco, TRUE, NULL);
g_io_channel_unref(hs->sco);
}
if (hs->rfcomm) {
- g_io_channel_close(hs->rfcomm);
+ g_io_channel_shutdown(hs->rfcomm, TRUE, NULL);
g_io_channel_unref(hs->rfcomm);
}
@@ -2341,7 +2341,7 @@ static int headset_close_rfcomm(struct audio_device *dev)
GIOChannel *rfcomm = hs->tmp_rfcomm ? hs->tmp_rfcomm : hs->rfcomm;
if (rfcomm) {
- g_io_channel_close(rfcomm);
+ g_io_channel_shutdown(rfcomm, TRUE, NULL);
g_io_channel_unref(rfcomm);
hs->tmp_rfcomm = NULL;
hs->rfcomm = NULL;
diff --git a/audio/main.c b/audio/main.c
index 0e5afc42..c3b5bb56 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -111,7 +111,7 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
return;
drop:
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
}
static DBusConnection *connection;
@@ -150,7 +150,7 @@ static int audio_init(void)
static void audio_exit(void)
{
if (sco_server) {
- g_io_channel_close(sco_server);
+ g_io_channel_shutdown(sco_server, TRUE, NULL);
g_io_channel_unref(sco_server);
sco_server = NULL;
}
diff --git a/audio/manager.c b/audio/manager.c
index d7ecfb40..77de2878 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -501,7 +501,7 @@ static void ag_confirm(GIOChannel *chan, gpointer data)
return;
drop:
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
}
static void hs_io_cb(GIOChannel *chan, GError *err, void *data)
@@ -592,13 +592,13 @@ failed:
error("%s", err->message);
g_error_free(err);
if (adapter->hsp_ag_server) {
- g_io_channel_close(adapter->hsp_ag_server);
+ g_io_channel_shutdown(adapter->hsp_ag_server, TRUE, NULL);
g_io_channel_unref(adapter->hsp_ag_server);
adapter->hsp_ag_server = NULL;
}
if (adapter->hfp_ag_server) {
- g_io_channel_close(adapter->hfp_ag_server);
+ g_io_channel_shutdown(adapter->hfp_ag_server, TRUE, NULL);
g_io_channel_unref(adapter->hfp_ag_server);
adapter->hfp_ag_server = NULL;
}
diff --git a/common/glib-helper.c b/common/glib-helper.c
index 29d72e56..e892a893 100644
--- a/common/glib-helper.c
+++ b/common/glib-helper.c
@@ -683,7 +683,7 @@ static gboolean hci_event_watch(GIOChannel *io,
failed:
cmd->cb(status, cmd->caller_data);
- g_io_channel_close(io);
+ g_io_channel_shutdown(io, TRUE, NULL);
return FALSE;
}
diff --git a/input/device.c b/input/device.c
index 4ab7aabc..3c050187 100644
--- a/input/device.c
+++ b/input/device.c
@@ -354,7 +354,7 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
*/
fake->uinput = uinput_create(idev->name);
if (fake->uinput < 0) {
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
reply = connection_attempt_failed(iconn->pending_connect,
strerror(errno));
goto failed;
@@ -405,7 +405,7 @@ static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data
gboolean connected = FALSE;
if (cond & (G_IO_HUP | G_IO_ERR))
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
emit_property_changed(idev->conn, idev->path, INPUT_DEVICE_INTERFACE,
"Connected", DBUS_TYPE_BOOLEAN, &connected);
@@ -429,7 +429,7 @@ static gboolean ctrl_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data
struct input_conn *iconn = data;
if (cond & (G_IO_HUP | G_IO_ERR))
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
g_source_remove(iconn->intr_watch);
iconn->intr_watch = 0;
@@ -687,7 +687,7 @@ static void interrupt_connect_cb(GIOChannel *chan, GError *conn_err,
err = hidp_add_connection(idev, iconn);
if (err < 0) {
err_msg = strerror(-err);
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
goto failed;
}
@@ -742,7 +742,7 @@ static void control_connect_cb(GIOChannel *chan, GError *conn_err,
reply = connection_attempt_failed(iconn->pending_connect,
err->message);
g_error_free(err);
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
goto failed;
}
@@ -766,7 +766,7 @@ static int fake_disconnect(struct input_conn *iconn)
if (!fake->io)
return -ENOTCONN;
- g_io_channel_close(fake->io);
+ g_io_channel_shutdown(fake->io, TRUE, NULL);
g_io_channel_unref(fake->io);
fake->io = NULL;
diff --git a/input/server.c b/input/server.c
index 88db485c..9cb958df 100644
--- a/input/server.c
+++ b/input/server.c
@@ -106,7 +106,7 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
if (gerr) {
error("%s", gerr->message);
g_error_free(gerr);
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
return;
}
@@ -121,7 +121,7 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
int err;
err = write(sk, unplug, sizeof(unplug));
}
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
return;
}
@@ -179,10 +179,10 @@ void server_stop(const bdaddr_t *src)
server = l->data;
- g_io_channel_close(server->intr);
+ g_io_channel_shutdown(server->intr, TRUE, NULL);
g_io_channel_unref(server->intr);
- g_io_channel_close(server->ctrl);
+ g_io_channel_shutdown(server->ctrl, TRUE, NULL);
g_io_channel_unref(server->ctrl);
servers = g_slist_remove(servers, server);
diff --git a/network/connection.c b/network/connection.c
index fd91bd27..bc693aba 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -170,7 +170,7 @@ static gboolean bnep_watchdog_cb(GIOChannel *chan, GIOCondition cond,
nc->state = DISCONNECTED;
memset(nc->dev, 0, 16);
strncpy(nc->dev, prefix, strlen(prefix));
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
return FALSE;
}
@@ -275,7 +275,7 @@ failed:
nc->state = DISCONNECTED;
reply = connection_attempt_failed(nc->msg, strerror(EIO));
g_dbus_send_message(connection, reply);
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
}
return FALSE;
@@ -339,7 +339,7 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer data)
if (perr < 0) {
err_msg = strerror(-perr);
error("bnep connect(): %s (%d)", err_msg, -perr);
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
g_io_channel_unref(chan);
goto failed;
}
diff --git a/network/server.c b/network/server.c
index 7e3b03a7..01ab5ed7 100644
--- a/network/server.c
+++ b/network/server.c
@@ -795,7 +795,7 @@ static DBusMessage *set_property(DBusConnection *conn,
static void adapter_free(struct network_adapter *na)
{
if (na->io != NULL) {
- g_io_channel_close(na->io);
+ g_io_channel_shutdown(na->io, TRUE, NULL);
g_io_channel_unref(na->io);
}
diff --git a/serial/port.c b/serial/port.c
index ddb07b2c..4946e158 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -324,7 +324,7 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *conn_err,
int err = errno;
error("ioctl(RFCOMMCREATEDEV): %s (%d)", strerror(err), err);
reply = failed(port->msg, strerror(err));
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
goto fail;
}
@@ -332,7 +332,7 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *conn_err,
debug("Serial port %s created", port->dev);
- g_io_channel_close(chan);
+ g_io_channel_shutdown(chan, TRUE, NULL);
/* Addressing connect port */
fd = port_open(port);
diff --git a/serial/proxy.c b/serial/proxy.c
index aab2e87d..3d21cc3b 100644
--- a/serial/proxy.c
+++ b/serial/proxy.c
@@ -265,7 +265,7 @@ static gboolean forward_data(GIOChannel *chan, GIOCondition cond, gpointer data)
err = channel_write(dest, buf, rbytes);
} while (err == G_IO_ERROR_NONE);
- g_io_channel_close(dest);
+ g_io_channel_shutdown(dest, TRUE, NULL);
return FALSE;
}
diff --git a/src/device.c b/src/device.c
index 8e83000f..fe369502 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1537,7 +1537,7 @@ static void bonding_request_free(struct bonding_req *bonding, gboolean close)
if (bonding->io) {
if (close)
- g_io_channel_close(bonding->io);
+ g_io_channel_shutdown(bonding->io, TRUE, NULL);
g_io_channel_unref(bonding->io);
}
@@ -1619,7 +1619,7 @@ static gboolean create_bonding_io_cb(GIOChannel *io, GIOCondition cond,
int sk, dd, ret;
if (!device->bonding) {
- g_io_channel_close(io);
+ g_io_channel_shutdown(io, TRUE, NULL);
return FALSE;
}
@@ -1723,7 +1723,7 @@ static gboolean create_bonding_io_cb(GIOChannel *io, GIOCondition cond,
return FALSE;
failed:
- g_io_channel_close(io);
+ g_io_channel_shutdown(io, TRUE, NULL);
cleanup:
device->bonding->io_id = 0;
@@ -1743,7 +1743,7 @@ static void create_bond_req_exit(DBusConnection *conn, void *user_data)
if (device->bonding) {
device->bonding->listener_id = 0;
- g_io_channel_close(device->bonding->io);
+ g_io_channel_shutdown(device->bonding->io, TRUE, NULL);
bonding_request_free(device->bonding, TRUE);
}
}
diff --git a/test/btiotest.c b/test/btiotest.c
index 9f4a1031..ede8a452 100644
--- a/test/btiotest.c
+++ b/test/btiotest.c
@@ -89,7 +89,7 @@ static gboolean disconn_timeout(gpointer user_data)
printf("Disconnecting\n");
- g_io_channel_close(data->io);
+ g_io_channel_shutdown(data->io, TRUE, NULL);
return FALSE;
}
@@ -130,7 +130,7 @@ static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
}
if (data->disconn == 0) {
- g_io_channel_close(io);
+ g_io_channel_shutdown(io, TRUE, NULL);
printf("Disconnected\n");
return;
}
@@ -158,7 +158,7 @@ static gboolean confirm_timeout(gpointer user_data)
if (data->reject >= 0) {
printf("Rejecting connection\n");
- g_io_channel_close(data->io);
+ g_io_channel_shutdown(data->io, TRUE, NULL);
return FALSE;
}
@@ -193,7 +193,7 @@ static void confirm_cb(GIOChannel *io, gpointer user_data)
if (data->reject == 0) {
printf("Rejecting connection\n");
- g_io_channel_close(io);
+ g_io_channel_shutdown(io, TRUE, NULL);
return;
}