From 3bad71c8c918315bea1cd492202b91aaebc617c9 Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Wed, 12 Sep 2018 00:30:04 +0800 Subject: [PATCH] Fix bug in epoll::del(...) --- gsock.cpp | 7 ++----- gsock.h | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/gsock.cpp b/gsock.cpp index ed050a9..cc307d1 100644 --- a/gsock.cpp +++ b/gsock.cpp @@ -1723,12 +1723,9 @@ int epoll::mod(vsock& v, int event) ev.data.ptr = &v; 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; - ev.events = event; - ev.data.ptr = &v; - return epoll_ctl(_fd, EPOLL_CTL_DEL, v._vp->sfd, &ev); + return epoll_ctl(_fd, EPOLL_CTL_DEL, v._vp->sfd, NULL); } int epoll::wait(int timeout) { diff --git a/gsock.h b/gsock.h index 078ee45..89b616e 100644 --- a/gsock.h +++ b/gsock.h @@ -354,9 +354,10 @@ class epoll public: epoll(int MaxListen); // EPOLLIN, EPOLLOUT, ... + // Use EPOLLET to set Edge Trigger Mode int add(vsock& v,int event); int mod(vsock& v,int event); - int del(vsock& v,int event); + int del(vsock& v); // >0: Event counts. // =0: Timeout.