aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2015-06-10 13:00:08 +0200
committerHenrik Nord <[email protected]>2015-06-10 13:00:19 +0200
commite01955643f503d1cb9d9450c22d5f02213117a91 (patch)
tree9dbfe3598653bffd2fd4c411d23e575fc22987fe /erts
parent355f4b567baf84c9ec3f61f70eaf64ff20500fd5 (diff)
parent34b858c3e329918d530da882b594d2db727d3856 (diff)
downloadotp-e01955643f503d1cb9d9450c22d5f02213117a91.tar.gz
otp-e01955643f503d1cb9d9450c22d5f02213117a91.tar.bz2
otp-e01955643f503d1cb9d9450c22d5f02213117a91.zip
Merge branch 'nybek/fix_inet_drv_add_multi_timer_logic'
* nybek/fix_inet_drv_add_multi_timer_logic: Fix add_multi_timer() in inet_drv Fix 6 tests in gen_tcp_misc_SUITE OTP-12817
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/drivers/common/inet_drv.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index e001f31932..10ef20fc82 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -12172,6 +12172,8 @@ static MultiTimerData *add_multi_timer(MultiTimerData **first, ErlDrvPort port,
void (*timeout_fun)(ErlDrvData drv_data,
ErlDrvTermData caller))
{
+#define eq_mega(a, b) ((a)->when.megasecs == (b)->when.megasecs)
+#define eq_sec(a, b) ((a)->when.secs == (b)->when.secs)
MultiTimerData *mtd, *p, *s;
mtd = ALLOC(sizeof(MultiTimerData));
absolute_timeout(timeout, &(mtd->when));
@@ -12183,23 +12185,17 @@ static MultiTimerData *add_multi_timer(MultiTimerData **first, ErlDrvPort port,
break;
}
}
- if (!p || p->when.megasecs > mtd->when.megasecs) {
- goto found;
- }
- for (; p!= NULL; s = p, p = p->next) {
+ for (; p!= NULL && eq_mega(p, mtd); s = p, p = p->next) {
if (p->when.secs >= mtd->when.secs) {
break;
}
}
- if (!p || p->when.secs > mtd->when.secs) {
- goto found;
- }
- for (; p!= NULL; s = p, p = p->next) {
+ for (; p!= NULL && eq_mega(p, mtd) && eq_sec(p, mtd); s = p, p = p->next) {
if (p->when.microsecs >= mtd->when.microsecs) {
break;
}
}
- found:
+
if (!p) {
if (!s) {
*first = mtd;
@@ -12225,6 +12221,8 @@ static MultiTimerData *add_multi_timer(MultiTimerData **first, ErlDrvPort port,
}
return mtd;
}
+#undef eq_mega
+#undef eq_sec