projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
you need to install+enable the apache module "proxy_balancer" for load balancing...
[pazpar2-moved-to-github.git]
/
src
/
eventl.c
diff --git
a/src/eventl.c
b/src/eventl.c
index
1d72235
..
f9f0dc2
100644
(file)
--- a/
src/eventl.c
+++ b/
src/eventl.c
@@
-32,6
+32,7
@@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <config.h>
#endif
#include <config.h>
#endif
+#include <math.h>
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include <assert.h>
@@
-114,8
+115,6
@@
IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags,
new_iochan->fd = fd;
new_iochan->flags = flags;
new_iochan->fun = cb;
new_iochan->fd = fd;
new_iochan->flags = flags;
new_iochan->fun = cb;
- new_iochan->socketfun = NULL;
- new_iochan->maskfun = NULL;
new_iochan->last_event = new_iochan->max_idle = 0;
new_iochan->next = NULL;
new_iochan->man = 0;
new_iochan->last_event = new_iochan->max_idle = 0;
new_iochan->next = NULL;
new_iochan->man = 0;
@@
-167,7
+166,7
@@
static int event_loop(iochan_man_t man, IOCHAN *iochans)
IOCHAN p, *nextp;
fd_set in, out, except;
int res, max;
IOCHAN p, *nextp;
fd_set in, out, except;
int res, max;
- static struct timeval nullto = {0, 0}, to;
+ static struct timeval to;
struct timeval *timeout;
FD_ZERO(&in);
struct timeval *timeout;
FD_ZERO(&in);
@@
-181,10
+180,6
@@
static int event_loop(iochan_man_t man, IOCHAN *iochans)
{
if (p->thread_users > 0)
continue;
{
if (p->thread_users > 0)
continue;
- if (p->maskfun)
- p->flags = (*p->maskfun)(p);
- if (p->socketfun)
- p->fd = (*p->socketfun)(p);
if (p->max_idle && p->max_idle < to.tv_sec)
to.tv_sec = p->max_idle;
if (p->fd < 0)
if (p->max_idle && p->max_idle < to.tv_sec)
to.tv_sec = p->max_idle;
if (p->fd < 0)
@@
-310,6
+305,18
@@
void iochan_man_events(iochan_man_t man)
event_loop(man, &man->channel_list);
}
event_loop(man, &man->channel_list);
}
+void pazpar2_sleep(double d)
+{
+#ifdef WIN32
+ Sleep( (DWORD) (d * 1000));
+#else
+ struct timeval tv;
+ tv.tv_sec = floor(d);
+ tv.tv_usec = (d - floor(d)) * 1000000;
+ select(0, 0, 0, 0, &tv);
+#endif
+}
+
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4