From 2eb708e5ad8b259876d24d828f7472b77864c256 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 21 Aug 2011 13:38:42 -0400 Subject: Cleaned up some of the socket code, cleaned up the pipe engines, added support for binary sockets, and cleaned up the asynch connect/accept code --- src/socketengines/socketengine_select.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/socketengines/socketengine_select.cpp') diff --git a/src/socketengines/socketengine_select.cpp b/src/socketengines/socketengine_select.cpp index 34a86f680..ad6e04ca9 100644 --- a/src/socketengines/socketengine_select.cpp +++ b/src/socketengines/socketengine_select.cpp @@ -96,19 +96,27 @@ void SocketEngine::Process() { Socket *s = it->second; - if (FD_ISSET(s->GetFD(), &efdset) || FD_ISSET(s->GetFD(), &rfdset) || FD_ISSET(s->GetFD(), &wfdset)) + bool has_read = FD_ISSET(s->GetFD(), &rfdset), has_write = FD_ISSET(s->GetFD(), &wfdset), has_error = FD_ISSET(s->GetFD(), &efdset); + if (has_read || has_write || has_error) ++processed; + if (s->HasFlag(SF_DEAD)) continue; - if (FD_ISSET(s->GetFD(), &efdset)) + + if (has_error) { s->ProcessError(); s->SetFlag(SF_DEAD); continue; } - if (FD_ISSET(s->GetFD(), &rfdset) && !s->ProcessRead()) + + if (!s->Process()) + continue; + + if (has_read && !s->ProcessRead()) s->SetFlag(SF_DEAD); - if (FD_ISSET(s->GetFD(), &wfdset) && !s->ProcessWrite()) + + if (has_write && !s->ProcessWrite()) s->SetFlag(SF_DEAD); } -- cgit