bufferevent
整合了evbuffer为以下bufferevent服务。
- Bufferevent_async支持异步IO、
- Bufferevent_filter过滤型,对进出bufferevent的数据增加一层过滤filter,http://blog.csdn.net/gqtcgq/article/details/43374387
- Bufferevent_openssl、
- Bufferevent_pair相互有数据传输的两个bufferevent、
- Bufferevent_sock、
- bufferevent_ratelim
callback
important-function
struct
struct bufferevent{
const struct bufferevent_ops *be_ops;
struct event ev_read;
struct event ev_write;
struct evbuffer *input;
struct evbuffer *output;
struct event_watermark wm_read;
struct event_watermark wm_write;
bufferevent_data_cb readcb;
bufferevent_data_cb writecb;
bufferevent_event_cb errorcb;
}
typedef void (*bufferevent_data_cb)(struct bufferevent *bev, void *ctx);
struct bufferevent_ops {
int (*enable)(struct bufferevent *, short);
int (*disable)(struct bufferevent *, short);
int (*flush)(struct bufferevent *, short, enum bufferevent_flush_mode);
。。。
。。。
}
bt
(gdb) bt
#0 conn_writecb (bev=0x6046e0, user_data=0x0) at /home/pro/echoServer/server/EventServer.cpp:24
#1 0x00007ffff7b929e3 in bufferevent_run_writecb_ (bufev=0x6046e0, options=0) at bufferevent.c:249
#2 0x00007ffff7b9918f in bufferevent_trigger_nolock_ (bufev=0x6046e0, iotype=4, options=0) at bufferevent-internal.h:369
#3 0x00007ffff7b99695 in bufferevent_writecb (fd=11, event=4, arg=0x6046e0) at bufferevent_sock.c:299
#4 0x00007ffff7b9dc3f in event_persist_closure (base=0x604080, ev=0x604770) at event.c:1531
#5 0x00007ffff7b9df28 in event_process_active_single_queue (base=0x604080, activeq=0x6044d0, max_to_process=2147483647, endtime=0x0) at event.c:1590
#6 0x00007ffff7b9e551 in event_process_active (base=0x604080) at event.c:1689
#7 0x00007ffff7b9ecad in event_base_loop (base=0x604080, flags=0) at event.c:1912
#8 0x00007ffff7b9e5d9 in event_base_dispatch (event_base=0x604080) at event.c:1723
#9 0x0000000000402599 in TcpServer::start (this=0x7fffffffdc90) at /home/pro/echoServer/server/EventServer.cpp:103
#10 0x0000000000401ded in TcpServerTest () at /home/pro/echoServer/server/main.cpp:28
#11 0x0000000000401eb5 in main () at /home/pro/echoServer/server/main.cpp:40
(gdb) c
Continuing.
Breakpoint 2, conn_readcb (bev=0x6046e0, user_data=0x0) at /home/pro/echoServer/server/EventServer.cpp:28
28 struct evbuffer *input = bufferevent_get_input(bev);
(gdb) bt
#0 conn_readcb (bev=0x6046e0, user_data=0x0) at /home/pro/echoServer/server/EventServer.cpp:28
#1 0x00007ffff7b9293c in bufferevent_run_readcb_ (bufev=0x6046e0, options=0) at bufferevent.c:233
#2 0x00007ffff7b99144 in bufferevent_trigger_nolock_ (bufev=0x6046e0, iotype=2, options=0) at bufferevent-internal.h:366
#3 0x00007ffff7b993bf in bufferevent_readcb (fd=11, event=2, arg=0x6046e0) at bufferevent_sock.c:189
#4 0x00007ffff7b9dc3f in event_persist_closure (base=0x604080, ev=0x6046f0) at event.c:1531
#5 0x00007ffff7b9df28 in event_process_active_single_queue (base=0x604080, activeq=0x6044d0, max_to_process=2147483647, endtime=0x0) at event.c:1590
#6 0x00007ffff7b9e551 in event_process_active (base=0x604080) at event.c:1689
#7 0x00007ffff7b9ecad in event_base_loop (base=0x604080, flags=0) at event.c:1912
#8 0x00007ffff7b9e5d9 in event_base_dispatch (event_base=0x604080) at event.c:1723
#9 0x0000000000402599 in TcpServer::start (this=0x7fffffffdc90) at /home/pro/echoServer/server/EventServer.cpp:103
#10 0x0000000000401ded in TcpServerTest () at /home/pro/echoServer/server/main.cpp:28
#11 0x0000000000401eb5 in main () at /home/pro/echoServer/server/main.cpp:40