Fix bug in epoll::del(...)

This commit is contained in:
Kirigaya Kazuto 2018-09-12 00:30:04 +08:00
parent 5071f615f2
commit 3bad71c8c9
2 changed files with 4 additions and 6 deletions

View File

@ -1723,12 +1723,9 @@ int epoll::mod(vsock& v, int event)
ev.data.ptr = &v; ev.data.ptr = &v;
return epoll_ctl(_fd, EPOLL_CTL_MOD, v._vp->sfd, &ev); return epoll_ctl(_fd, EPOLL_CTL_MOD, v._vp->sfd, &ev);
} }
int epoll::del(vsock& v, int event) int epoll::del(vsock& v)
{ {
struct epoll_event ev; return epoll_ctl(_fd, EPOLL_CTL_DEL, v._vp->sfd, NULL);
ev.events = event;
ev.data.ptr = &v;
return epoll_ctl(_fd, EPOLL_CTL_DEL, v._vp->sfd, &ev);
} }
int epoll::wait(int timeout) int epoll::wait(int timeout)
{ {

View File

@ -354,9 +354,10 @@ class epoll
public: public:
epoll(int MaxListen); epoll(int MaxListen);
// EPOLLIN, EPOLLOUT, ... // EPOLLIN, EPOLLOUT, ...
// Use EPOLLET to set Edge Trigger Mode
int add(vsock& v,int event); int add(vsock& v,int event);
int mod(vsock& v,int event); int mod(vsock& v,int event);
int del(vsock& v,int event); int del(vsock& v);
// >0: Event counts. // >0: Event counts.
// =0: Timeout. // =0: Timeout.