summaryrefslogtreecommitdiffstats
path: root/tcpsrv.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-06-23 10:29:15 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-06-23 10:29:15 +0200
commit7b1a570d54ac4c82325aeeee70d7a8871ecd688a (patch)
tree68b2ab1fc7f85f7eca8d9d0d8270074c6cfb6bce /tcpsrv.c
parent716ab25446cd45ec8117264e51b5018f9a813d4e (diff)
downloadrsyslog-7b1a570d54ac4c82325aeeee70d7a8871ecd688a.tar.gz
rsyslog-7b1a570d54ac4c82325aeeee70d7a8871ecd688a.tar.xz
rsyslog-7b1a570d54ac4c82325aeeee70d7a8871ecd688a.zip
changed Rcv-Interface in tcpsrv subsystem
It is now iRet based. This enables us to communicate more in-depth information to the upper peers. This is needed to handle the EGAIN case on rcv (not yet implemented)
Diffstat (limited to 'tcpsrv.c')
-rw-r--r--tcpsrv.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tcpsrv.c b/tcpsrv.c
index dca6eb0c..0ae1f423 100644
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -404,6 +404,7 @@ Run(tcpsrv_t *pThis)
tcps_sess_t *pNewSess;
nssel_t *pSel;
int state;
+ ssize_t iRcvd;
ISOBJ_TYPE_assert(pThis, tcpsrv);
@@ -452,11 +453,13 @@ Run(tcpsrv_t *pThis)
dbgprintf("netstream %p with new data\n", pThis->pSessions[iTCPSess]->pStrm);
/* Receive message */
- state = pThis->pRcvData(pThis->pSessions[iTCPSess], buf, sizeof(buf));
- if(state == 0) {
+ iRet = pThis->pRcvData(pThis->pSessions[iTCPSess], buf, sizeof(buf), &iRcvd);
+ if(iRet == RS_RET_CLOSED) {
pThis->pOnRegularClose(pThis->pSessions[iTCPSess]);
tcps_sess.Destruct(&pThis->pSessions[iTCPSess]);
- } else if(state == -1) {
+ } else if(iRet == RS_RET_RETRY) {
+ /* we simply ignore retry - this is not an error, but we also have not received anything */
+ } else if(iRet == RS_RET_OK) {
errno = 0;
errmsg.LogError(NO_ERRCODE, "netstream session %p will be closed due to error\n",
pThis->pSessions[iTCPSess]->pStrm);
@@ -464,7 +467,7 @@ Run(tcpsrv_t *pThis)
tcps_sess.Destruct(&pThis->pSessions[iTCPSess]);
} else {
/* valid data received, process it! */
- if(tcps_sess.DataRcvd(pThis->pSessions[iTCPSess], buf, state) != RS_RET_OK) {
+ if(tcps_sess.DataRcvd(pThis->pSessions[iTCPSess], buf, iRcvd) != RS_RET_OK) {
/* in this case, something went awfully wrong.
* We are instructed to terminate the session.
*/
@@ -563,7 +566,7 @@ SetCBIsPermittedHost(tcpsrv_t *pThis, int (*pCB)(struct sockaddr *addr, char *fr
}
static rsRetVal
-SetCBRcvData(tcpsrv_t *pThis, int (*pRcvData)(tcps_sess_t*, char*, size_t))
+SetCBRcvData(tcpsrv_t *pThis, rsRetVal (*pRcvData)(tcps_sess_t*, char*, size_t, ssize_t*))
{
DEFiRet;
pThis->pRcvData = pRcvData;