forked from linyacool/WebServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChannel.cpp
More file actions
executable file
·63 lines (56 loc) · 940 Bytes
/
Copy pathChannel.cpp
File metadata and controls
executable file
·63 lines (56 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// @Author Lin Ya
// @Email [email protected]
#include "Channel.h"
#include "Util.h"
#include "Epoll.h"
#include "EventLoop.h"
#include <unistd.h>
#include <queue>
#include <cstdlib>
#include <iostream>
using namespace std;
Channel::Channel(EventLoop *loop):
loop_(loop),
events_(0),
lastEvents_(0)
{ }
Channel::Channel(EventLoop *loop, int fd):
loop_(loop),
fd_(fd),
events_(0),
lastEvents_(0)
{ }
Channel::~Channel()
{
//loop_->poller_->epoll_del(fd, events_);
//close(fd_);
}
int Channel::getFd()
{
return fd_;
}
void Channel::setFd(int fd)
{
fd_ = fd;
}
void Channel::handleRead()
{
if (readHandler_)
{
readHandler_();
}
}
void Channel::handleWrite()
{
if (writeHandler_)
{
writeHandler_();
}
}
void Channel::handleConn()
{
if (connHandler_)
{
connHandler_();
}
}