Dolda2000 GitWeb
/
ashd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bc5f1a7
)
lib: Fixed blocker iteration bug in mtio-select introduced by mblock.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 31 Dec 2016 17:36:47 +0000
(18:36 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 31 Dec 2016 17:37:24 +0000
(18:37 +0100)
lib/mtio-select.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/mtio-select.c
b/lib/mtio-select.c
index
6e9a767
..
e0a4177
100644
(file)
--- a/
lib/mtio-select.c
+++ b/
lib/mtio-select.c
@@
-36,12
+36,17
@@
static int exitstatus;
struct blocker {
struct blocker *n, *p;
struct blocker {
struct blocker *n, *p;
+ struct iterator *it;
int fd;
int ev, rev, id;
time_t to;
struct muth *th;
};
int fd;
int ev, rev, id;
time_t to;
struct muth *th;
};
+struct iterator {
+ struct blocker *bl;
+};
+
static void addblock(struct blocker *bl)
{
bl->n = blockers;
static void addblock(struct blocker *bl)
{
bl->n = blockers;
@@
-58,6
+63,11
@@
static void remblock(struct blocker *bl)
bl->p->n = bl->n;
if(bl == blockers)
blockers = bl->n;
bl->p->n = bl->n;
if(bl == blockers)
blockers = bl->n;
+ if(bl->it) {
+ if((bl->it->bl = bl->n) != NULL)
+ bl->it->bl->it = bl->it;
+ bl->it = NULL;
+ }
}
struct selected mblock(time_t to, int n, struct selected *spec)
}
struct selected mblock(time_t to, int n, struct selected *spec)
@@
-111,7
+121,8
@@
int ioloop(void)
{
int ret;
fd_set rfds, wfds, efds;
{
int ret;
fd_set rfds, wfds, efds;
- struct blocker *bl, *nbl;
+ struct blocker *bl;
+ struct iterator it;
struct timeval toval;
time_t now, timeout;
int maxfd;
struct timeval toval;
time_t now, timeout;
int maxfd;
@@
-150,8
+161,9
@@
int ioloop(void)
}
} else {
now = time(NULL);
}
} else {
now = time(NULL);
- for(bl = blockers; bl; bl = nbl) {
- nbl = bl->n;
+ for(bl = it.bl = blockers; bl; bl = it.bl) {
+ if((it.bl = bl->n) != NULL)
+ it.bl->it = ⁢
ev = 0;
if(FD_ISSET(bl->fd, &rfds))
ev |= EV_READ;
ev = 0;
if(FD_ISSET(bl->fd, &rfds))
ev |= EV_READ;
@@
-174,6
+186,8
@@
int ioloop(void)
resume(bl->th, bl->id);
}
}
resume(bl->th, bl->id);
}
}
+ if(it.bl)
+ it.bl->it = NULL;
}
}
}
}
}
}