summaryrefslogtreecommitdiffstats
path: root/runtime/nsdsel_ptcp.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-23 15:07:19 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-23 15:07:19 +0200
commit1892fc75f9fad0b0741b4a3eb1fc382f900b2301 (patch)
treea863e25521c3dd5988bdea1499a41c47106ae81f /runtime/nsdsel_ptcp.c
parent2be459c4d7645ad12f83723be7bb26199fe98b82 (diff)
downloadrsyslog-1892fc75f9fad0b0741b4a3eb1fc382f900b2301.tar.gz
rsyslog-1892fc75f9fad0b0741b4a3eb1fc382f900b2301.tar.xz
rsyslog-1892fc75f9fad0b0741b4a3eb1fc382f900b2301.zip
added new netstrms class
netstrms is at the top layer of the socket abstraction
Diffstat (limited to 'runtime/nsdsel_ptcp.c')
-rw-r--r--runtime/nsdsel_ptcp.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/runtime/nsdsel_ptcp.c b/runtime/nsdsel_ptcp.c
index 67f3c62a..c5864809 100644
--- a/runtime/nsdsel_ptcp.c
+++ b/runtime/nsdsel_ptcp.c
@@ -131,7 +131,7 @@ Select(nsdsel_t *pNsdsel, int *piNumReady)
/* check if a socket is ready for IO */
static rsRetVal
-IsReady(nsdsel_t *pNsdsel, nsd_t *pNsd, nsdsel_waitOp_t waitOp)
+IsReady(nsdsel_t *pNsdsel, nsd_t *pNsd, nsdsel_waitOp_t waitOp, int *pbIsReady)
{
DEFiRet;
nsdsel_ptcp_t *pThis = (nsdsel_ptcp_t*) pNsdsel;
@@ -139,6 +139,21 @@ IsReady(nsdsel_t *pNsdsel, nsd_t *pNsd, nsdsel_waitOp_t waitOp)
ISOBJ_TYPE_assert(pThis, nsdsel_ptcp);
ISOBJ_TYPE_assert(pSock, nsd_ptcp);
+ assert(pbIsReady != NULL);
+
+ switch(waitOp) {
+ case NSDSEL_RD:
+ *pbIsReady = FD_ISSET(pSock->sock, &pThis->readfds);
+ break;
+ case NSDSEL_WR:
+ *pbIsReady = FD_ISSET(pSock->sock, &pThis->writefds);
+ break;
+ case NSDSEL_RDWR:
+ *pbIsReady = FD_ISSET(pSock->sock, &pThis->readfds)
+ | FD_ISSET(pSock->sock, &pThis->writefds);
+ break;
+ }
+
RETiRet;
}