Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Apr 2009 23:33:30 +0000 (UTC)
From:      Maksim Yevmenkin <emax@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191232 - head/usr.sbin/bluetooth/btpand
Message-ID:  <200904172333.n3HNXU80038817@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emax
Date: Fri Apr 17 23:33:30 2009
New Revision: 191232
URL: http://svn.freebsd.org/changeset/base/191232

Log:
  Fix bug in event timeout handling
  
  Submitted by:	mav
  MFC after:	3 days

Modified:
  head/usr.sbin/bluetooth/btpand/event.c

Modified: head/usr.sbin/bluetooth/btpand/event.c
==============================================================================
--- head/usr.sbin/bluetooth/btpand/event.c	Fri Apr 17 23:22:06 2009	(r191231)
+++ head/usr.sbin/bluetooth/btpand/event.c	Fri Apr 17 23:33:30 2009	(r191232)
@@ -110,12 +110,12 @@ __event_dispatch(void)
 		event_del(ev);
 
 		if (ev->flags & EV_HAS_TIMEOUT) {
-			t = now;
-
-			if (tv_cmp(&t, &ev->expire) <= 0)
+			if (tv_cmp(&now, &ev->expire) >= 0)
 				t.tv_sec = t.tv_usec = 0;
-			else
-				tv_sub(&t, &ev->expire);
+			else {
+				t = ev->expire;
+				tv_sub(&t, &now);
+			}
 
 			if (tv_cmp(&t, &timeout) < 0)
 				timeout = t;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904172333.n3HNXU80038817>