From 68b30fce07b70e9ef74b948001ed009f86a3744c Mon Sep 17 00:00:00 2001 From: wens Date: Sat, 25 Jun 2011 15:11:47 +0000 Subject: Common timeout should be global. Fix usage line. git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5363 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/daemon/barebone/server.c | 6 +++--- pttbbs/daemon/barebone/server.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pttbbs/daemon/barebone/server.c b/pttbbs/daemon/barebone/server.c index bfb1c4da..df347abd 100644 --- a/pttbbs/daemon/barebone/server.c +++ b/pttbbs/daemon/barebone/server.c @@ -32,7 +32,8 @@ #include "server.h" -static const struct timeval *common_timeout; +static const struct timeval timeout = {600, 0}; +const struct timeval *common_timeout = &timeout; int split_args(char *line, char ***argp) @@ -114,7 +115,7 @@ int main(int argc, char *argv[]) break; case 'h': default: - fprintf(stderr, "usage: " " [-D] [-i] [-l interface_ip:port]\n"); + fprintf(stderr, "Usage: %s [-D] [-i] [-l interface_ip:port]\n", argv[0]); exit(EXIT_FAILURE); } @@ -127,7 +128,6 @@ int main(int argc, char *argv[]) base = event_base_new(); assert(base); - const struct timeval timeout = {600, 0}; common_timeout = event_base_init_common_timeout(base, &timeout); if (!inetd) { diff --git a/pttbbs/daemon/barebone/server.h b/pttbbs/daemon/barebone/server.h index 9cba93b7..1a6822e5 100644 --- a/pttbbs/daemon/barebone/server.h +++ b/pttbbs/daemon/barebone/server.h @@ -10,6 +10,8 @@ #define MAX_ARGS 100 #endif +extern const struct timeval *common_timeout; + extern void client_read_cb(struct bufferevent *bev, void *ctx); extern void client_event_cb(struct bufferevent *bev, short events, void *ctx); extern void setup_client(struct event_base *base, evutil_socket_t fd, -- cgit v1.2.3