From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 08/10] android/socket: Strip extra log messages
Date: Thu, 28 Nov 2013 16:38:04 +0200 [thread overview]
Message-ID: <1385649486-19978-8-git-send-email-Andrei.Emeltchenko.news@gmail.com> (raw)
In-Reply-To: <1385649486-19978-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Remove debug messages when sending data, debug still exist for connection
establishment. Do not print error when connection hang up, print debug
instead.
---
android/socket.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/android/socket.c b/android/socket.c
index 3f07dc6..45ff90e 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -488,11 +488,12 @@ static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
unsigned char buf[1024];
int len, sent;
- DBG("rfsock: fd %d real_sock %d chan %u sock %d",
- rfsock->fd, rfsock->real_sock, rfsock->channel,
- g_io_channel_unix_get_fd(io));
+ if (cond & G_IO_HUP) {
+ DBG("Socket %d hang up", g_io_channel_unix_get_fd(io));
+ goto fail;
+ }
- if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+ if (cond & (G_IO_ERR | G_IO_NVAL)) {
error("Socket error: sock %d cond %d",
g_io_channel_unix_get_fd(io), cond);
goto fail;
@@ -505,16 +506,12 @@ static gboolean sock_stack_event_cb(GIOChannel *io, GIOCondition cond,
return TRUE;
}
- DBG("read %d bytes write to %d", len, rfsock->real_sock);
-
sent = try_write_all(rfsock->real_sock, buf, len);
if (sent < 0) {
error("write(): %s", strerror(errno));
goto fail;
}
- DBG("Written %d bytes", sent);
-
return TRUE;
fail:
connections = g_list_remove(connections, rfsock);
@@ -530,11 +527,12 @@ static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
unsigned char buf[1024];
int len, sent;
- DBG("rfsock: fd %d real_sock %d chan %u sock %d",
- rfsock->fd, rfsock->real_sock, rfsock->channel,
- g_io_channel_unix_get_fd(io));
+ if (cond & G_IO_HUP) {
+ DBG("Socket %d hang up", g_io_channel_unix_get_fd(io));
+ goto fail;
+ }
- if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+ if (cond & (G_IO_ERR | G_IO_NVAL)) {
error("Socket error: sock %d cond %d",
g_io_channel_unix_get_fd(io), cond);
goto fail;
@@ -547,16 +545,12 @@ static gboolean sock_rfcomm_event_cb(GIOChannel *io, GIOCondition cond,
return TRUE;
}
- DBG("read %d bytes, write to fd %d", len, rfsock->fd);
-
sent = try_write_all(rfsock->fd, buf, len);
if (sent < 0) {
error("write(): %s", strerror(errno));
goto fail;
}
- DBG("Written %d bytes", sent);
-
return TRUE;
fail:
connections = g_list_remove(connections, rfsock);
--
1.8.3.2
next prev parent reply other threads:[~2013-11-28 14:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-28 14:37 [PATCH 01/10] android: Avoid memory leak warnings for event_loop Andrei Emeltchenko
2013-11-28 14:37 ` [PATCH 02/10] android/main: Remove timeout source on exit Andrei Emeltchenko
2013-11-28 14:37 ` [PATCH 03/10] android/main: Remove signal " Andrei Emeltchenko
2013-11-28 14:38 ` [PATCH 04/10] android/main: Free enabled string " Andrei Emeltchenko
2013-11-29 8:29 ` Johan Hedberg
2013-11-28 14:38 ` [PATCH 05/10] android/socket: Cleanup sockets on unregister Andrei Emeltchenko
2013-11-29 8:26 ` Johan Hedberg
2013-11-28 14:38 ` [PATCH 06/10] android/socket: Fix rfsock lists Andrei Emeltchenko
2013-11-28 14:38 ` [PATCH 07/10] android/hidhost: Shutdown ctrl_io channel if intr_io fails Andrei Emeltchenko
2013-11-28 14:38 ` Andrei Emeltchenko [this message]
2013-11-28 14:38 ` [PATCH 09/10] android/socket: Avoid double close of file descriptor Andrei Emeltchenko
2013-11-28 14:38 ` [PATCH 10/10] android/socket: Remove unneeded code Andrei Emeltchenko
2013-11-29 8:31 ` Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1385649486-19978-8-git-send-email-Andrei.Emeltchenko.news@gmail.com \
--to=andrei.emeltchenko.news@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox