-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathChannel.cpp
58 lines (48 loc) · 998 Bytes
/
Channel.cpp
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
/*************************************************************************
> File Name: Channel.cpp
> Author: zhangfeng
> Mail: [email protected]
> Created Time: Fri 04 Oct 2019 01:58:10 PM CST
> Target:
************************************************************************/
#include "Channel.h"
#include <unistd.h>
#include <queue>
#include <cstdio>
#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() {}
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_();
}
}