Linux bluetooth development
 help / color / mirror / Atom feed
From: David Herrmann <dh.herrmann@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Michael Biebl <mbiebl@gmail.com>,
	David Herrmann <dh.herrmann@gmail.com>
Subject: [PATCH] core: fix unbound watchdog-notify for timeouts <2s
Date: Sat, 13 Sep 2014 15:21:23 +0200	[thread overview]
Message-ID: <1410614483-8462-1-git-send-email-dh.herrmann@gmail.com> (raw)

If the watchdog timeout is below 2s, we end up with a timeout of 0s as
glib event source. This causes unbound watchdog notifications. Avoid this
by never using event-timeouts below 1s.

Reported by Michael Biebl.

---
 src/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index e6bac6e..da0bd12 100644
--- a/src/main.c
+++ b/src/main.c
@@ -596,9 +596,10 @@ int main(int argc, char *argv[])
 
 		seconds = atoi(watchdog_usec) / (1000 * 1000);
 		info("Watchdog timeout is %d seconds", seconds);
+		seconds = (seconds < 4) ? 1 : seconds / 2;
 
 		watchdog = g_timeout_add_seconds_full(G_PRIORITY_HIGH,
-							seconds / 2,
+							seconds,
 							watchdog_callback,
 							NULL, NULL);
 	} else
-- 
2.1.0

             reply	other threads:[~2014-09-13 13:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-13 13:21 David Herrmann [this message]
2014-09-13 16:54 ` [PATCH] core: fix unbound watchdog-notify for timeouts <2s Marcel Holtmann
2014-09-13 19:11   ` David Herrmann
2014-09-14 17:41     ` David Herrmann
2014-09-14 17:54       ` Marcel Holtmann

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=1410614483-8462-1-git-send-email-dh.herrmann@gmail.com \
    --to=dh.herrmann@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mbiebl@gmail.com \
    /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