commit - 4c0ae0c3cf2253e2e929fcb85c907f3a17116e1f
commit + 057b5ab72f72be49038ae43aed7727cdb212bbb7
blob - 8aac4d962d6767f5211339c98ffd37e018d1ce81
blob + 5a11f3f989fb1713410426a02fdd65e2097103e6
--- configure.ac
+++ configure.ac
])
fi
-# Checks for library functions.
-AC_SEARCH_LIBS([arc4random], [],
- [AC_DEFINE([HAVE_ARC4RANDOM], 1, [arc4random])],
- [AC_DEFINE([HAVE_ARC4RANDOM], 0, [arc4random])])
-
AC_REPLACE_FUNCS([
asprintf \
err \
blob - 4022322122fd289cec715309ee170891d58a5d37
blob + 59ebc0fe956c7b3a89e53b9ba825ceed19fa703b
--- kamid/listener.c
+++ kamid/listener.c
event_del(&c->event);
event_set(&c->event, c->fd, EV_WRITE, fn, c);
event_add(&c->event, NULL);
-}
-
-static inline uint32_t
-random_id(void)
-{
-#if HAVE_ARC4RANDOM
-# define RANDID() arc4random()
-#else
- /* not as pretty as a random id */
- static uint32_t counter = 0;
-# define RANDID() counter++
-#endif
-
- struct client find, *res;
-
- for (;;) {
- find.id = RANDID();
- res = SPLAY_FIND(clients_tree_id, &clients, &find);
- if (res == NULL)
- return find.id;
- }
-
-#undef RANDID
}
static void
handle_accept(int fd, short ev, void *data)
{
+ static uint32_t counter;
struct kd_listen_conf *listen = data;
struct client *c;
int s;
}
c->fd = s;
- c->id = random_id();
+ c->id = counter++;
SPLAY_INSERT(clients_tree_id, &clients, c);