projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make tunnel library actually work with X.509 certificate authentication.
[tinc]
/
fd
/
fd.c
diff --git
a/fd/fd.c
b/fd/fd.c
index
b969205
..
e658c1d
100644
(file)
--- a/
fd/fd.c
+++ b/
fd/fd.c
@@
-34,7
+34,7
@@
static avl_tree_t *fds;
volatile bool fd_running = false;
int fd_compare(struct fd *a, struct fd *b) {
volatile bool fd_running = false;
int fd_compare(struct fd *a, struct fd *b) {
- return
(a->fd - b->fd) ?: (a->mode - b->mode)
;
+ return
a->fd - b->fd
;
};
bool fd_init(void) {
};
bool fd_init(void) {
@@
-42,7
+42,7
@@
bool fd_init(void) {
FD_ZERO(&readset);
FD_ZERO(&writeset);
FD_ZERO(&readset);
FD_ZERO(&writeset);
- FD_ZERO(&e
xcept
set);
+ FD_ZERO(&e
rror
set);
fds = avl_tree_new((avl_compare_t)fd_compare, NULL);
fds = avl_tree_new((avl_compare_t)fd_compare, NULL);
@@
-79,10
+79,14
@@
bool fd_del(struct fd *fd) {
FD_CLR(fd->fd, &writeset);
FD_CLR(fd->fd, &errorset);
FD_CLR(fd->fd, &writeset);
FD_CLR(fd->fd, &errorset);
- if(fd->fd >= max_fd)
- max_fd = ((struct fd *)fds->tail)->fd;
+ avl_del(fds, fd);
- return avl_del(fds, fd);
+ if(fds->tail)
+ max_fd = ((struct fd *)fds->tail->data)->fd;
+ else
+ max_fd = 0;
+
+ return true;
};
bool fd_mod(struct fd *fd) {
};
bool fd_mod(struct fd *fd) {