summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules.c26
-rw-r--r--src/sockutil.c3
2 files changed, 14 insertions, 15 deletions
diff --git a/src/modules.c b/src/modules.c
index 2f42654da..ba93f317e 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -1718,21 +1718,17 @@ int moduleAddCallback(char *name, time_t when,
void moduleCallBackRun(void)
{
ModuleCallBack *tmp;
- if (!moduleCallBackHead) {
- return;
- }
- tmp = moduleCallBackHead;
- if (tmp->when <= time(NULL)) {
- if (debug)
- alog("debug: executing callback: %s", tmp->name ? tmp->name : "?");
- if (tmp->func) {
- mod_current_module_name = tmp->owner_name;
- tmp->func(tmp->argc, tmp->argv);
- mod_current_module = NULL;
- moduleCallBackDeleteEntry(NULL); /* delete the head */
- }
- }
- return;
+
+ while ((tmp = moduleCallBackHead) && (tmp->when <= time(NULL))) {
+ if (debug)
+ alog("debug: executing callback: %s", tmp->name ? tmp->name : "<unknown>");
+ if (tmp->func) {
+ mod_current_module_name = tmp->owner_name;
+ tmp->func(tmp->argc, tmp->argv);
+ mod_current_module = NULL;
+ moduleCallBackDeleteEntry(NULL);
+ }
+ }
}
/**
diff --git a/src/sockutil.c b/src/sockutil.c
index d5f390fbf..2308dd528 100644
--- a/src/sockutil.c
+++ b/src/sockutil.c
@@ -415,6 +415,8 @@ char *sgets(char *buf, int len, ano_socket_t s)
fd_set fds;
char *ptr = buf;
+ flush_write_buffer(0);
+
if (len == 0)
return NULL;
FD_SET(s, &fds);
@@ -424,6 +426,7 @@ char *sgets(char *buf, int len, ano_socket_t s)
(c = select(s + 1, &fds, NULL, NULL, &tv)) < 0) {
if (ano_sockgeterr() != EINTR)
break;
+ flush_write_buffer(0);
}
if (read_buffer_len() == 0 && c == 0)
return (char *) -1;