diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-04-12 16:20:13 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-04-12 16:20:13 +0200 |
commit | 612384b3d46d06eea6fd71ee6dc60471d0f9e3d1 (patch) | |
tree | f9926b5ca8841a30c3a16916116a7d4102e91c31 /src/socketengines | |
parent | e3303330f8cc04121907715d789370f492878646 (diff) |
Dispatch EventHandler events to dedicated virtual functions
Remove enum EventType
Diffstat (limited to 'src/socketengines')
-rw-r--r-- | src/socketengines/socketengine_epoll.cpp | 8 | ||||
-rw-r--r-- | src/socketengines/socketengine_kqueue.cpp | 6 | ||||
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 8 | ||||
-rw-r--r-- | src/socketengines/socketengine_ports.cpp | 4 | ||||
-rw-r--r-- | src/socketengines/socketengine_select.cpp | 6 |
5 files changed, 16 insertions, 16 deletions
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 29404f416..8548e0824 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -182,7 +182,7 @@ int SocketEngine::DispatchEvents() if (ev.events & EPOLLHUP) { stats.ErrorEvents++; - eh->HandleEvent(EVENT_ERROR, 0); + eh->OnEventHandlerError(0); continue; } @@ -194,7 +194,7 @@ int SocketEngine::DispatchEvents() int errcode; if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0) errcode = errno; - eh->HandleEvent(EVENT_ERROR, errcode); + eh->OnEventHandlerError(errcode); continue; } @@ -215,7 +215,7 @@ int SocketEngine::DispatchEvents() if (ev.events & EPOLLIN) { stats.ReadEvents++; - eh->HandleEvent(EVENT_READ); + eh->OnEventHandlerRead(); if (eh != GetRef(fd)) // whoa! we got deleted, better not give out the write event continue; @@ -223,7 +223,7 @@ int SocketEngine::DispatchEvents() if (ev.events & EPOLLOUT) { stats.WriteEvents++; - eh->HandleEvent(EVENT_WRITE); + eh->OnEventHandlerWrite(); } } diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index 8cc8a33f9..922cb7f2d 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -194,7 +194,7 @@ int SocketEngine::DispatchEvents() if (kev.flags & EV_EOF) { stats.ErrorEvents++; - eh->HandleEvent(EVENT_ERROR, kev.fflags); + eh->OnEventHandlerError(kev.fflags); continue; } if (filter == EVFILT_WRITE) @@ -206,13 +206,13 @@ int SocketEngine::DispatchEvents() */ const int bits_to_clr = FD_WANT_SINGLE_WRITE | FD_WANT_FAST_WRITE | FD_WRITE_WILL_BLOCK; eh->SetEventMask(eh->GetEventMask() & ~bits_to_clr); - eh->HandleEvent(EVENT_WRITE); + eh->OnEventHandlerWrite(); } else if (filter == EVFILT_READ) { stats.ReadEvents++; eh->SetEventMask(eh->GetEventMask() & ~FD_READ_WILL_BLOCK); - eh->HandleEvent(EVENT_READ); + eh->OnEventHandlerRead(); } } diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index dc63fe0ed..5fd7e6235 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -185,7 +185,7 @@ int SocketEngine::DispatchEvents() if (revents & POLLHUP) { - eh->HandleEvent(EVENT_ERROR, 0); + eh->OnEventHandlerError(0); continue; } @@ -196,14 +196,14 @@ int SocketEngine::DispatchEvents() int errcode; if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0) errcode = errno; - eh->HandleEvent(EVENT_ERROR, errcode); + eh->OnEventHandlerError(errcode); continue; } if (revents & POLLIN) { eh->SetEventMask(eh->GetEventMask() & ~FD_READ_WILL_BLOCK); - eh->HandleEvent(EVENT_READ); + eh->OnEventHandlerRead(); if (eh != GetRef(fd)) // whoops, deleted out from under us continue; @@ -217,7 +217,7 @@ int SocketEngine::DispatchEvents() // The vector could've been resized, reference can be invalid by now; don't use it events[index].events = mask_to_poll(mask); - eh->HandleEvent(EVENT_WRITE); + eh->eh->OnEventHandlerWrite(); } } diff --git a/src/socketengines/socketengine_ports.cpp b/src/socketengines/socketengine_ports.cpp index 0d77954e4..d94d02664 100644 --- a/src/socketengines/socketengine_ports.cpp +++ b/src/socketengines/socketengine_ports.cpp @@ -160,14 +160,14 @@ int SocketEngine::DispatchEvents() if (portev_events & POLLRDNORM) { stats.ReadEvents++; - eh->HandleEvent(EVENT_READ); + eh->OnEventHandlerRead(); if (eh != GetRef(fd)) continue; } if (portev_events & POLLWRNORM) { stats.WriteEvents++; - eh->HandleEvent(EVENT_WRITE); + eh->OnEventHandlerWrite(); } } diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index f44346ad8..6dfbae88e 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -141,7 +141,7 @@ int SocketEngine::DispatchEvents() if (getsockopt(i, SOL_SOCKET, SO_ERROR, (char*)&errcode, &codesize) < 0) errcode = errno; - ev->HandleEvent(EVENT_ERROR, errcode); + ev->OnEventHandlerError(errcode); continue; } @@ -149,7 +149,7 @@ int SocketEngine::DispatchEvents() { stats.ReadEvents++; ev->SetEventMask(ev->GetEventMask() & ~FD_READ_WILL_BLOCK); - ev->HandleEvent(EVENT_READ); + ev->OnEventHandlerRead(); if (ev != GetRef(i)) continue; } @@ -160,7 +160,7 @@ int SocketEngine::DispatchEvents() int newmask = (ev->GetEventMask() & ~(FD_WRITE_WILL_BLOCK | FD_WANT_SINGLE_WRITE)); SocketEngine::OnSetEvent(ev, ev->GetEventMask(), newmask); ev->SetEventMask(newmask); - ev->HandleEvent(EVENT_WRITE); + ev->OnEventHandlerWrite(); } } |