Skip to content

Commit

Permalink
faithd using libevent (http://www.monkey.org/~provos/libevent/)
Browse files Browse the repository at this point in the history
- still forks for every client
- OOB data does not work well
- ftp not touched at all
  • Loading branch information
itojun committed Jun 11, 2002
1 parent 07f9556 commit db19eb1
Show file tree
Hide file tree
Showing 10 changed files with 2,571 additions and 8 deletions.
41 changes: 41 additions & 0 deletions kame/kame/faithd.libevent/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 1996 WIDE Project. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifications, are permitted provided that the above copyright notice
# and this paragraph are duplicated in all such forms and that any
# documentation, advertising materials, and other materials related to
# such distribution and use acknowledge that the software was developed
# by the WIDE Project, Japan. The name of the Project may not be used to
# endorse or promote products derived from this software without
# specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS''
# AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
# LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE.

.if exists(${.CURDIR}/../Makefile.opsys)
.include "${.CURDIR}/../Makefile.opsys"
.endif

BINDIR= ${PREFIX}/sbin
PROG= faithd
SRCS= faithd.c tcp.c ftp.c prefix.c

# libevent 0.4
SRCS+= event.c select.c

.if (${OPSYS} != "NetBSD")
CFLAGS+= -I${.CURDIR}
CFLAGS+= -DHAVE_SELECT
.else
CPPFLAGS+= -I${.CURDIR} -DHAVE_SELECT
.endif
LDADD+= -lutil
DPADD+= ${LIBUTIL}
NOMAN=yes
#.if (${OPSYS} != "NetBSD")
#MAN8= faithd.8
#.else
#MAN= faithd.8
#.endif

.include <bsd.prog.mk>
10 changes: 5 additions & 5 deletions kame/kame/faithd.libevent/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"

#include <sys/types.h>
#include <sys/tree.h>
Expand Down Expand Up @@ -238,13 +237,13 @@ event_pending(struct event *ev, short event, struct timeval *tv)
int flags = 0;

if (ev->ev_flags & EVLIST_INSERTED)
flags |= (ev->ev_events & (EV_READ|EV_WRITE));
flags |= (ev->ev_events & (EV_READ|EV_WRITE|EV_EXCEPT));
if (ev->ev_flags & EVLIST_ACTIVE)
flags |= ev->ev_res;
if (ev->ev_flags & EVLIST_TIMEOUT)
flags |= EV_TIMEOUT;

event &= (EV_TIMEOUT|EV_READ|EV_WRITE);
event &= (EV_TIMEOUT|EV_READ|EV_WRITE|EV_EXCEPT);

/* See if there is a timeout that we should report */
if (tv != NULL && (flags & event & EV_TIMEOUT))
Expand All @@ -257,10 +256,11 @@ int
event_add(struct event *ev, struct timeval *tv)
{
LOG_DBG((LOG_MISC, 55,
"event_add: event: %p, %s%s%scall %p",
"event_add: event: %p, %s%s%s%scall %p",
ev,
ev->ev_events & EV_READ ? "EV_READ " : " ",
ev->ev_events & EV_WRITE ? "EV_WRITE " : " ",
ev->ev_events & EV_EXCEPT ? "EV_EXCEPT " : " ",
tv ? "EV_TIMEOUT " : " ",
ev->ev_callback));

Expand All @@ -281,7 +281,7 @@ event_add(struct event *ev, struct timeval *tv)
event_queue_insert(ev, EVLIST_TIMEOUT);
}

if ((ev->ev_events & (EV_READ|EV_WRITE)) &&
if ((ev->ev_events & (EV_READ|EV_WRITE|EV_EXCEPT)) &&
!(ev->ev_flags & EVLIST_INSERTED)) {
event_queue_insert(ev, EVLIST_INSERTED);

Expand Down
1 change: 1 addition & 0 deletions kame/kame/faithd.libevent/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ extern "C" {
#define EV_TIMEOUT 0x01
#define EV_READ 0x02
#define EV_WRITE 0x04
#define EV_EXCEPT 0x08

/* Fix so that ppl dont have to run with <sys/queue.h> */
#ifndef TAILQ_ENTRY
Expand Down
Loading

0 comments on commit db19eb1

Please sign in to comment.