make read buffer size templated
This commit is contained in:
parent
242e996ded
commit
9d33a89bc1
@ -14,11 +14,12 @@ namespace nntpchan
|
||||
{
|
||||
namespace ev
|
||||
{
|
||||
template<size_t bufsz>
|
||||
struct EpollLoop : public Loop
|
||||
{
|
||||
size_t conns;
|
||||
int epollfd;
|
||||
char readbuf[128];
|
||||
char readbuf[bufsz];
|
||||
EpollLoop() : conns(0), epollfd(epoll_create1(EPOLL_CLOEXEC))
|
||||
{
|
||||
}
|
||||
|
@ -1,14 +1,17 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
constexpr size_t ev_buffsz = 512;
|
||||
|
||||
#ifdef __linux__
|
||||
#include "epoll.hpp"
|
||||
typedef nntpchan::ev::EpollLoop LoopImpl;
|
||||
typedef nntpchan::ev::EpollLoop<ev_buffsz> LoopImpl;
|
||||
#else
|
||||
#ifdef __freebsd__
|
||||
#include "kqueue.hpp"
|
||||
typedef nntpchan::ev::KqueueLoop LoopImpl;
|
||||
typedef nntpchan::ev::KqueueLoop<ev_buffsz> LoopImpl;
|
||||
#else
|
||||
#ifdef __netbsd__
|
||||
typedef nntpchan::ev::KqueueLoop LoopImpl;
|
||||
typedef nntpchan::ev::KqueueLoop<ev_buffsz> LoopImpl;
|
||||
#else
|
||||
#error "unsupported platform"
|
||||
#endif
|
||||
|
@ -6,11 +6,12 @@ namespace nntpchan
|
||||
{
|
||||
namespace ev
|
||||
{
|
||||
template<size_t bufsz>
|
||||
struct KqueueLoop : public Loop
|
||||
{
|
||||
int kfd;
|
||||
size_t conns;
|
||||
char readbuf[1024];
|
||||
char readbuf[bufsz];
|
||||
|
||||
|
||||
KqueueLoop() : kfd(kqueue()), conns(0)
|
||||
|
Reference in New Issue
Block a user