diff options
| author | Franklin Wei <git@fwei.tk> | 2016-01-16 20:05:58 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2016-01-16 20:05:58 -0500 |
| commit | 98896de83ffa7380404e41b6ed80cfc6ba3bf8f0 (patch) | |
| tree | 427f48b92d647c6278df083f86d33a7545710a6c /src/server.c | |
| parent | 056220075ca575c17899abea7b3a2fb55e64b561 (diff) | |
| download | netcosm-98896de83ffa7380404e41b6ed80cfc6ba3bf8f0.zip netcosm-98896de83ffa7380404e41b6ed80cfc6ba3bf8f0.tar.gz netcosm-98896de83ffa7380404e41b6ed80cfc6ba3bf8f0.tar.bz2 netcosm-98896de83ffa7380404e41b6ed80cfc6ba3bf8f0.tar.xz | |
packetized requests
Diffstat (limited to 'src/server.c')
| -rw-r--r-- | src/server.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/server.c b/src/server.c index 5b963b6..50f055f 100644 --- a/src/server.c +++ b/src/server.c @@ -114,7 +114,7 @@ static void __attribute__((noreturn)) serv_cleanup(void) if(!child) break; ptr = NULL; - kill(child->pid, SIGKILL); + //kill(child->pid, SIGKILL); } while(1); handle_disconnects(); @@ -275,15 +275,11 @@ static void new_connection_cb(EV_P_ ev_io *w, int revents) int readpipe[2]; /* child->parent */ int outpipe [2]; /* parent->child */ - if(pipe(readpipe) < 0) + if(pipe2(readpipe, O_DIRECT) < 0) error("pipe"); - if(pipe(outpipe) < 0) + if(pipe2(outpipe, O_NONBLOCK | O_DIRECT) < 0) error("pipe"); - int flags = fcntl(outpipe[0], F_GETFL, 0); - if(fcntl(outpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) - error("fcntl"); - pid_t pid = fork(); if(pid < 0) error("fork"); @@ -348,9 +344,14 @@ static void new_connection_cb(EV_P_ ev_io *w, int revents) int main(int argc, char *argv[]) { + debugf("*** Starting NetCosm "NETCOSM_VERSION" (libev %d.%d, libgcrypt "GCRYPT_VERSION") ***\n", + EV_VERSION_MAJOR, EV_VERSION_MINOR); + assert(ev_version_major() == EV_VERSION_MAJOR && ev_version_minor() >= EV_VERSION_MINOR); + assert(!strcmp(GCRYPT_VERSION, gcry_check_version(GCRYPT_VERSION))); + if(argc != 2) port = PORT; else |