跳至主要内容

博文

libevent设置SOL_SOCKET后反而tcp带宽降低的问题

原因是:  listen的socket需要单独设置下,不然有问题 auto fd = evconnlistener_get_fd(listener) set_socket_buffer(fd , MAX_SOCKET_BUFFER )    
最新博文

源码编译LLVM

  cmake -S llvm -B build -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt;libc;openmp" -DCMAKE_BUILD_TYPE=Release   cd build/   make -j8

libevent2的一些api

 server: auto listener = evconnlistener_new_bind(base, listener_cb, (void *) base, LEV_OPT_REUSEABLE | LEV_OPT_CLOSE_ON_FREE,                                             -1, (struct sockaddr *) &sin, sizeof(sin));  在 listener_cb中 bufferevent_socket_new bufferevent_setcb bufferevent_enable   在read_cb中 evbuffer_get_length evbuffer_copyout evbuffer_copyout_from evbuffer_drain     client: bufferevent_socket_new bufferevent_setcb bufferevent_enable bufferevent_socket_connect timer: event_new(base, -1, EV_PERSIST, timer_cb, NULL) event_add