|
Revision f41090dab0be1c792f9587e2d2930761969ace33, 0.8 kB
(checked in by Theo Schlossnagle <jesus@omniti.com>, 5 years ago)
|
more work -- this doesn't do much except add plumbing
|
- Property mode set to
100644
|
| Line | |
|---|
| 1 |
#include "noit_defines.h" |
|---|
| 2 |
|
|---|
| 3 |
#include <stdio.h> |
|---|
| 4 |
#include <stdlib.h> |
|---|
| 5 |
|
|---|
| 6 |
#include "eventer/eventer.h" |
|---|
| 7 |
#include "utils/noit_log.h" |
|---|
| 8 |
#include "noit_listener.h" |
|---|
| 9 |
#include "noit_console.h" |
|---|
| 10 |
|
|---|
| 11 |
int stdin_handler(eventer_t e, int mask, void *closure, struct timeval *now) { |
|---|
| 12 |
fprintf(stderr, "in stdin_handler:\n"); |
|---|
| 13 |
return EVENTER_READ; |
|---|
| 14 |
} |
|---|
| 15 |
void stdin_sample() { |
|---|
| 16 |
eventer_t e; |
|---|
| 17 |
e = eventer_alloc(); |
|---|
| 18 |
e->fd = 0; |
|---|
| 19 |
e->mask = EVENTER_READ; |
|---|
| 20 |
e->callback = stdin_handler; |
|---|
| 21 |
eventer_add(e); |
|---|
| 22 |
} |
|---|
| 23 |
int main(int argc, char **argv) { |
|---|
| 24 |
noit_log_init(); |
|---|
| 25 |
if(eventer_choose("kqueue") == -1) { |
|---|
| 26 |
fprintf(stderr, "Cannot choose kqueue\n"); |
|---|
| 27 |
exit(-1); |
|---|
| 28 |
} |
|---|
| 29 |
if(eventer_init() == -1) { |
|---|
| 30 |
fprintf(stderr, "Cannot init kqueue\n"); |
|---|
| 31 |
exit(-1); |
|---|
| 32 |
} |
|---|
| 33 |
|
|---|
| 34 |
stdin_sample(); |
|---|
| 35 |
noit_listener("127.0.0.1", 23123, SOCK_STREAM, 5, noit_console_handler, NULL); |
|---|
| 36 |
eventer_loop(); |
|---|
| 37 |
return 0; |
|---|
| 38 |
} |
|---|