diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-06-24 15:12:22 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-06-24 15:12:22 +0200 |
commit | b5d8f5d96aeff3e95cac135f9250da6e9d799382 (patch) | |
tree | 36c2a72530fa881120cf2cd315784461d6a8d25c /tcpsrv.c | |
parent | b711a34a075cf3979f48937f8af8b05030644e82 (diff) | |
download | rsyslog-b5d8f5d96aeff3e95cac135f9250da6e9d799382.tar.gz rsyslog-b5d8f5d96aeff3e95cac135f9250da6e9d799382.tar.xz rsyslog-b5d8f5d96aeff3e95cac135f9250da6e9d799382.zip |
added support for EGAIN while trying to receive data on gTLS session
This maps to bugzilla bug 83: http://bugzilla.adiscon.com/show_bug.cgi?id=83
This is the first test version, posted to user for repro of the problem.
It contains code to handle the case, HOWEVER, I have not been able to test it
in a scenario where a retry actually happens while receiving (I dont't get this
in my environment). So I assume it is buggy and will probably not work.
Diffstat (limited to 'tcpsrv.c')
-rw-r--r-- | tcpsrv.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -406,7 +406,6 @@ Run(tcpsrv_t *pThis) int bIsReady; tcps_sess_t *pNewSess; nssel_t *pSel; - int state; ssize_t iRcvd; ISOBJ_TYPE_assert(pThis, tcpsrv); @@ -457,18 +456,15 @@ Run(tcpsrv_t *pThis) /* Receive message */ iRet = pThis->pRcvData(pThis->pSessions[iTCPSess], buf, sizeof(buf), &iRcvd); - if(iRet == RS_RET_CLOSED) { + switch(iRet) { + case RS_RET_CLOSED: pThis->pOnRegularClose(pThis->pSessions[iTCPSess]); tcps_sess.Destruct(&pThis->pSessions[iTCPSess]); - } else if(iRet == RS_RET_RETRY) { + break; + case 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); - pThis->pOnErrClose(pThis->pSessions[iTCPSess]); - tcps_sess.Destruct(&pThis->pSessions[iTCPSess]); - } else { + break; + case RS_RET_OK: /* valid data received, process it! */ if(tcps_sess.DataRcvd(pThis->pSessions[iTCPSess], buf, iRcvd) != RS_RET_OK) { /* in this case, something went awfully wrong. @@ -479,6 +475,14 @@ Run(tcpsrv_t *pThis) pThis->pOnErrClose(pThis->pSessions[iTCPSess]); tcps_sess.Destruct(&pThis->pSessions[iTCPSess]); } + break; + default: + errno = 0; + errmsg.LogError(NO_ERRCODE, "netstream session %p will be closed due to error\n", + pThis->pSessions[iTCPSess]->pStrm); + pThis->pOnErrClose(pThis->pSessions[iTCPSess]); + tcps_sess.Destruct(&pThis->pSessions[iTCPSess]); + break; } --nfds; /* indicate we have processed one */ } |