svn commit: r191232 - head/usr.sbin/bluetooth/btpand

Maksim Yevmenkin emax at FreeBSD.org
Fri Apr 17 23:33:31 UTC 2009


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;


More information about the svn-src-all mailing list