ref: b967a87de8358d35b37a4a524c95ae549ee40460
parent: 889af18831aba0673a2456f05a1987b972d22df6
author: libredev <libredev@ircforever.org>
date: Wed Nov 23 13:52:32 EST 2022
fixed event_frequency
--- a/main.c
+++ b/main.c
@@ -133,7 +133,7 @@
char *cmd;
ssize_t n;
- int i, count = 0;
+ int i, count = 0, *ids;
Htiter it = {0};
if ((revents & PICOEV_TIMEOUT) != 0) {
@@ -140,10 +140,14 @@
printf("TIME to add %d more connections\n", EVENT_FREQUENCY);
while (htiterate(users, &it)) {
for (i = 0; i < netlen; i++) {
- if (((int *)it.node->val)[i] == 0) {
- ((int *)it.node->val)[i] = clone_add(loop, it.node->key, i);
+ ids = (int *)it.node->val;
+ buf = (char *)it.node->key;
+ if (ids[i] == 0) {
+ fd = clone_add(loop, buf, i);
+ ids[i] = fd;
+ printf("%d. %d: %s\n", count, fd, buf);
count++;
- if (count >= 10)
+ if (count >= EVENT_FREQUENCY)
goto return_time;
}
}