Skip to content
Permalink
Browse files

Some network error conditions were missing...

  • Loading branch information...
frozenblit committed Apr 26, 2019
1 parent 0bed27c commit 3c92f711eee6f06780290609bd98d3f908f02231
Showing with 8 additions and 6 deletions.
  1. +8 −6 pol-core/clib/network/singlepollers/pollingwithpoll.h
@@ -26,8 +26,7 @@ namespace Clib
class PollingWithPoll
{
public:
explicit PollingWithPoll( SOCKET socket )
: default_timeout{0, 0}, processed( false )
explicit PollingWithPoll( SOCKET socket ) : default_timeout{0, 0}, processed( false )
{
fdList.fd = socket;
reset();
@@ -42,11 +41,14 @@ class PollingWithPoll
}

void notify_on_incoming() { fdList.events |= POLLIN; }
void notify_on_error() {} // do nothing, poll() always notifies on error
void notify_on_error() {} // do nothing, poll() always notifies on error
void notify_on_writable() { fdList.events |= POLLOUT; }

bool incoming() { return ( processed ) ? ( (fdList.revents & POLLIN) != 0 ) : false; }
bool error() { return ( processed ) ? ( ( fdList.revents & POLLERR ) != 0 ) : false; }
bool incoming() { return ( processed ) ? ( ( fdList.revents & POLLIN ) != 0 ) : false; }
bool error()
{
return ( processed ) ? ( ( fdList.revents & ( POLLHUP | POLLERR | POLLNVAL ) ) != 0 ) : false;
}
bool writable() { return ( processed ) ? ( ( fdList.revents & POLLOUT ) != 0 ) : false; }

void set_timeout( int timeout_sec, int timeout_usec )
@@ -78,7 +80,7 @@ class PollingWithPoll
bool valid_socket() { return fdList.fd != INVALID_SOCKET; }

private:
pollfd fdList; // a list of 1, this is a single poller
pollfd fdList; // a list of 1, this is a single poller

timeval default_timeout;
bool processed;

0 comments on commit 3c92f71

Please sign in to comment.
You can’t perform that action at this time.