Skip to content

Commit

Permalink
boardd: change session_{create->start}, a more reasonable name; refin…
Browse files Browse the repository at this point in the history
…e some formatting.
  • Loading branch information
robertabcd committed Mar 18, 2015
1 parent 64b7b5a commit db4fa8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions daemon/boardd/boardd.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,9 @@ void session_create(struct event_base *base, evutil_socket_t fd,

void
setup_client(struct event_base *base, evutil_socket_t fd,
struct sockaddr *address, int socklen)
struct sockaddr *address, int socklen)
{
session_create(base, fd, address, socklen);
session_start(base, fd, address, socklen);
}

void
Expand Down
4 changes: 2 additions & 2 deletions daemon/boardd/boardd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

int process_line(struct evbuffer *output, void *ctx, char *line);

void session_create(struct event_base *base, evutil_socket_t fd,
struct sockaddr *address, int socklen);
void session_start(struct event_base *base, evutil_socket_t fd,
struct sockaddr *address, int socklen);

void session_init();
void session_shutdown();
Expand Down
16 changes: 6 additions & 10 deletions daemon/boardd/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,19 @@ class LineProcessJob

static ThreadPool<LineProcessJob> *g_threadpool;

static void
read_cb(struct bufferevent *bev, void *ctx)
static void read_cb(struct bufferevent *bev, void *ctx)
{
reinterpret_cast<Session *>(ctx)->on_read();
}

static void
event_cb(struct bufferevent *bev, short events, void *ctx)
static void event_cb(struct bufferevent *bev, short events, void *ctx)
{
reinterpret_cast<Session *>(ctx)->on_error(events);
}

} // namespace

void
session_init()
void session_init()
{
#ifdef BOARDD_MT
fprintf(stderr, "boardd: built with mulit-threading, %d threads.\n",
Expand All @@ -66,14 +63,13 @@ session_init()
#endif
}

void
session_shutdown()
void session_shutdown()
{
delete g_threadpool;
}

void session_create(struct event_base *base, evutil_socket_t fd,
struct sockaddr *address, int socklen)
void session_start(struct event_base *base, evutil_socket_t fd,
struct sockaddr *address, int socklen)
{
new Session(process_line, base, fd, address, socklen);
}
Expand Down

0 comments on commit db4fa8e

Please sign in to comment.