Permalink
Browse files

- lophttpd: move aio log provider to UNSUPPORTED, theres no good

  single-thread AIO implementation on Linux anyways
- frontend: remove ifdef, switching to flavor::
  • Loading branch information...
stealth committed Mar 9, 2012
1 parent 95d8741 commit 8ee30e696559d003fafe7591214540ed640e4112
Showing with 8 additions and 28 deletions.
  1. +2 −0 flavor.h
  2. +4 −14 log.cc
  3. +2 −14 rproxy.cc
View
@@ -45,6 +45,8 @@ enum {
NONBLOCK = 1
};
// return a (unblocking if NONBLOCK flag is set) accepted socket
int accept(int, struct sockaddr *, socklen_t *, int);
bool servable_device(const struct stat &);
View
18 log.cc
@@ -59,8 +59,8 @@ int log_provider::open_log(const string &logfile, const string &method, int core
if (method != "mmap")
flags |= O_APPEND;
// safe default
// safe default
do_log = &log_provider::write_log;
char lfile[1024];
@@ -72,21 +72,11 @@ int log_provider::open_log(const string &logfile, const string &method, int core
return -1;
}
#ifndef ANDROID
memset(&log_aio, 0, sizeof(log_aio));
#endif
log_area = (void *)-1;
log_index = 0;
log_size = 1<<20;
#ifdef ANDROID
if (method == "aio")
do_log = &log_provider::write_log;
#else
if (method == "aio")
do_log = &log_provider::aio_log;
#endif
else if (method == "mmap") {
if (method == "mmap") {
if (fstat(log_fd, &st) < 0) {
err = "log_provider::open_log::fstat:";
err += strerror(errno);
@@ -159,7 +149,7 @@ int log_provider::mmap_log(const string &msg)
}
#ifndef ANDROID
#ifdef AIO_UNUSED
int log_provider::aio_log(const string &msg)
{
int count = 0;
View
@@ -45,6 +45,7 @@
#include "lonely.h"
#include "config.h"
#include "rproxy.h"
#include "flavor.h"
using namespace rproxy_config;
@@ -124,27 +125,14 @@ int rproxy::loop()
if (fd2state[i]->state == STATE_ACCEPTING) {
pfds[i].revents = 0;
for (;;) {
#ifdef linux
afd = accept4(i, (struct sockaddr *)&sin, &slen, SOCK_NONBLOCK);
#else
afd = accept(i, (struct sockaddr *)&sin, &slen);
#endif
afd = flavor::accept(i, (struct sockaddr *)&sin, &slen, flavor::NONBLOCK);
if (afd < 0)
break;
nodelay(afd);
pfds[afd].fd = afd;
pfds[afd].events = POLLIN;
pfds[afd].revents = 0;
#ifndef linux
if (fcntl(afd, F_SETFL, O_RDWR|O_NONBLOCK) < 0) {
cleanup(afd);
err = "rproxy::loop::fcntl:";
err += strerror(errno);
return -1;
}
#endif
if (!fd2state[afd]) {
fd2state[afd] = new (nothrow) rproxy_state;

0 comments on commit 8ee30e6

Please sign in to comment.