From 46a84600a6e5c8eef55f8c751d1670d17d96b7bd Mon Sep 17 00:00:00 2001 From: kpl Date: Wed, 18 Mar 2020 17:20:38 -0400 Subject: [PATCH] cwSocket.cpp : Added extended socket status checking in _poll(). --- cwSocket.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/cwSocket.cpp b/cwSocket.cpp index 89ec827..865b2b2 100644 --- a/cwSocket.cpp +++ b/cwSocket.cpp @@ -231,7 +231,7 @@ namespace cw goto errLabel; if( s->cbFunc != nullptr ) - s->cbFunc( s->cbArg, kConnectCbId, s->userId, s->connId, nullptr, 0, (const struct sockaddr_in*)&remoteAddr ); + s->cbFunc( s->cbArg, kConnectCbId, s->userId, cs->connId, nullptr, 0, (const struct sockaddr_in*)&remoteAddr ); errLabel: @@ -359,6 +359,22 @@ namespace cw // interate through the ports looking for the ones which have data waiting ... for(unsigned i=0; isockN; ++i) + { + if( p->sockA[i].pollfd->revents & POLLERR ) + { + printf("ERROR\n"); + } + + if( p->sockA[i].pollfd->revents & POLLHUP ) + { + printf("HUP\n"); + } + + if( p->sockA[i].pollfd->revents & POLLNVAL ) + { + printf("NVAL\n"); + } + if( p->sockA[i].pollfd->revents & POLLIN ) { unsigned actualReadN = 0; @@ -384,7 +400,8 @@ namespace cw readN_Ref += actualReadN; } - + } + p->sockN += newSockN; }