summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/imtcp/imtcp.c2
-rw-r--r--runtime/nsd_gtls.c8
-rw-r--r--runtime/nsd_ptcp.c7
3 files changed, 13 insertions, 4 deletions
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index 4d31744d..49d48633 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -109,7 +109,7 @@ doRcvData(tcps_sess_t *pSess, char *buf, size_t lenBuf, ssize_t *piLenRcvd)
assert(piLenRcvd != NULL);
*piLenRcvd = lenBuf;
- CHKiRet(netstrm.Rcv(pSess->pStrm, (uchar*) buf, piLenRcvd) != RS_RET_OK);
+ CHKiRet(netstrm.Rcv(pSess->pStrm, (uchar*) buf, piLenRcvd));
finalize_it:
RETiRet;
}
diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c
index 2bb8f3d9..8e95eca8 100644
--- a/runtime/nsd_gtls.c
+++ b/runtime/nsd_gtls.c
@@ -1457,11 +1457,13 @@ Rcv(nsd_t *pNsd, uchar *pBuf, ssize_t *pLenBuf)
/* now check if we have something in our buffer. If so, we satisfy
* the request from buffer contents.
*/
+ if(pThis->lenRcvBuf == -1) { /* no data present, must read */
+ CHKiRet(gtlsRecordRecv(pThis));
+ }
+
if(pThis->lenRcvBuf == 0) { /* EOS */
*pLenBuf = 0;
- FINALIZE;
- } else if(pThis->lenRcvBuf == -1) { /* no data present, must read */
- CHKiRet(gtlsRecordRecv(pThis));
+ ABORT_FINALIZE(RS_RET_CLOSED);
}
/* if we reach this point, data is present in the buffer and must be copied */
diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c
index ff85619a..93be8081 100644
--- a/runtime/nsd_ptcp.c
+++ b/runtime/nsd_ptcp.c
@@ -535,6 +535,13 @@ Rcv(nsd_t *pNsd, uchar *pRcvBuf, ssize_t *pLenBuf)
*pLenBuf = recv(pThis->sock, pRcvBuf, *pLenBuf, MSG_DONTWAIT);
+ if(*pLenBuf == 0) {
+ ABORT_FINALIZE(RS_RET_CLOSED);
+ } else if (*pLenBuf < 0) {
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
+finalize_it:
RETiRet;
}