From d9f1a16de4723f9e096fa9abe47e8a845c815df0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 16 Oct 2009 09:33:21 +0200 Subject: improved input thread termination for imtcp and imuxsock --- tcpsrv.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tcpsrv.c') diff --git a/tcpsrv.c b/tcpsrv.c index 49d8a099..5fe98a91 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -565,6 +565,8 @@ Run(tcpsrv_t *pThis) break; /* terminate input! */ for(i = 0 ; i < pThis->iLstnCurr ; ++i) { + if(glbl.GetGlobalInputTermState() == 1) + ABORT_FINALIZE(RS_RET_FORCE_TERM); CHKiRet(nssel.IsReady(pSel, pThis->ppLstn[i], NSDSEL_RD, &bIsReady, &nfds)); if(bIsReady) { DBGPRINTF("New connect on NSD %p.\n", pThis->ppLstn[i]); @@ -576,6 +578,8 @@ Run(tcpsrv_t *pThis) /* now check the sessions */ iTCPSess = TCPSessGetNxtSess(pThis, -1); while(nfds && iTCPSess != -1) { + if(glbl.GetGlobalInputTermState() == 1) + ABORT_FINALIZE(RS_RET_FORCE_TERM); CHKiRet(nssel.IsReady(pSel, pThis->pSessions[iTCPSess]->pStrm, NSDSEL_RD, &bIsReady, &nfds)); if(bIsReady) { doReceive(pThis, &pThis->pSessions[iTCPSess]); -- cgit v1.2.3 From e04e1b50025f5fa9c26abd946190dce8f797d08f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 22 Oct 2009 11:33:38 +0200 Subject: enhanced test environment (including testbench) support for enhancing probability of memory addressing failure by using non-NULL default value for malloced memory (optional, only if requested by configure option). This helps to track down some otherwise undetected issues within the testbench and is expected to be very useful in the future. --- tcpsrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tcpsrv.c') diff --git a/tcpsrv.c b/tcpsrv.c index 5fe98a91..7d3a5848 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -104,7 +104,7 @@ addNewLstnPort(tcpsrv_t *pThis, uchar *pszPort) ISOBJ_TYPE_assert(pThis, tcpsrv); /* create entry */ - CHKmalloc(pEntry = malloc(sizeof(tcpLstnPortList_t))); + CHKmalloc(pEntry = MALLOC(sizeof(tcpLstnPortList_t))); pEntry->pszPort = pszPort; pEntry->pSrv = pThis; pEntry->pRuleset = pThis->pRuleset; -- cgit v1.2.3 From 471801ef4e96bd3d3fc5a468ca0feb8837f08268 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 11 Nov 2009 10:51:46 +0100 Subject: added a bit of doc and improved an error message --- tcpsrv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tcpsrv.c') diff --git a/tcpsrv.c b/tcpsrv.c index 7d3a5848..ef453f3a 100644 --- a/tcpsrv.c +++ b/tcpsrv.c @@ -473,6 +473,7 @@ doReceive(tcpsrv_t *pThis, tcps_sess_t **ppSess) { char buf[128*1024]; /* reception buffer - may hold a partial or multiple messages */ ssize_t iRcvd; + rsRetVal localRet; DEFiRet; ISOBJ_TYPE_assert(pThis, tcpsrv); @@ -498,11 +499,11 @@ doReceive(tcpsrv_t *pThis, tcps_sess_t **ppSess) break; case RS_RET_OK: /* valid data received, process it! */ - if(tcps_sess.DataRcvd(*ppSess, buf, iRcvd) != RS_RET_OK) { + if((localRet = tcps_sess.DataRcvd(*ppSess, buf, iRcvd)) != RS_RET_OK) { /* in this case, something went awfully wrong. * We are instructed to terminate the session. */ - errmsg.LogError(0, NO_ERRCODE, "Tearing down TCP Session - see " + errmsg.LogError(0, localRet, "Tearing down TCP Session - see " "previous messages for reason(s)\n"); pThis->pOnErrClose(*ppSess); tcps_sess.Destruct(ppSess); -- cgit v1.2.3